Question

A function that receives two integers and the operation to be performed and returns the result, use pseint step by step

257

likes
1287 views

Answer to a math question A function that receives two integers and the operation to be performed and returns the result, use pseint step by step

Expert avatar
Nash
4.9
87 Answers
Para resolver este problema, vamos a seguir los siguientes pasos utilizando PseInt:

Paso 1: Solicitar al usuario que ingrese dos números enteros y la operación a realizar.
Paso 2: Leer los dos números enteros y la operación.
Paso 3: Realizar la operación solicitada (suma, resta, multiplicación o división) con los dos números.
Paso 4: Devolver el resultado de la operación.
Paso 5: Fin.

Ahora vamos a escribir el pseudocódigo para este problema paso a paso:

```
Algoritmo FuncionOperacion
Definir num1, num2, resultado Como Entero
Definir operacion Como Caracter

Escribir "Ingrese el primer número: "
Leer num1

Escribir "Ingrese el segundo número: "
Leer num2

Escribir "Ingrese la operación a realizar (+, -, *, /): "
Leer operacion

Segun operacion Hacer
' Realizar la operación correspondiente
Segun op
caso "+":
resultado = num1 + num2
caso "-":
resultado = num1 - num2
caso "*":
resultado = num1 * num2
caso "/":
resultado = num1 / num2
FinSegun

Escribir "El resultado es: ", resultado
FinAlgoritmo
```

Este pseudocódigo recibe dos números enteros y la operación a realizar, luego realiza la operación deseada y muestra el resultado.

**Respuesta:** La función que reciba dos números enteros y la operación a realizar y devuelva el resultado puede implementarse en PseInt siguiendo los pasos mencionados anteriormente.

Frequently asked questions (FAQs)
What is the median of a dataset with 8 elements if the 4th and 5th elements are both 10?
+
Math question: Find the absolute extrema of the function f(x) = 2x^3 - 6x^2 + 9x - 4 on the interval [-2, 2].
+
Convert 3π/4 radians to degrees.
+
New questions in Mathematics
-6n+5=-13
A car tire can rotate at a frequency of 3000 revolutions per minute. Given that a typical tire radius is 0.5 m, what is the centripetal acceleration of the tire?
what is 9% of 307
What payment 7 months from now would be equivalent in value to a $3,300 payment due 23 months from now? The value of money is 2.7% simple interest. Round your answer to 2 decimal places. Show all work and how you arrive at the answer..
The sum of two numbers is 6, and the sum of their squares is 28. Find these numbers exactly
A bird randomly chooses to land on 1 of 12 perches available in its aviary. Determine the Probability of it landing on a perch numbered 8 and then on a perch marked with a prime number; take into account that he never lands on the same perch in the sequence.
Supposed 60% of the register voters in a country or democrat. If a sample of 793 voters is selected, what is the probability that the sample proportion of Democrats will be greater than 64% round your answer to four decimal places
The actual length of an object is 1.3 m . If the blueprint uses a scale of 1 : 12 , what is the length of the line on the drawing?
Log(45)
A person borrows rm 1000 from a bank at an interest rate of 10%. After some time, he pays the bank rm 1900 as full and final settlement of the loan. Estimate the duration of his loan.
Reparameterize the curve r(t)= cos(t)i without (t)j (t)k by the arc length.
A circular window has a rubber molding around the edge. If the window has a radius of 250 mm, how long is the piece of molding that is required ? (To the nearest mm)
There are 3 orchards, a, b and c. Orchard a has 60 fewer trees than orchard b orchard c has 3 times as many trees as orchard b. If the three orchards have 430 trees altogether, how many trees does orchard c have?
Determine the kinetic energy of a baseball whose mass is 100 grams and has a speed of 30 m/s.
Find the equation of a straight line that has slope 3 and passes through the point of (1, 7) . Write the equation of the line in general forms
Find the set of points formed by the expression 𝜋<|𝑧−4+2𝑖|<3𝜋.
Square root of 169 with steps
How many digits are there in Hindu-Arabic form of numeral 26 × 1011
g(x)=3(x+8). What is the value of g(12)
3(x-4)=156