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 equation of an exponential function if it has a vertical asymptote at x = 2 and a y-intercept at (0, -3)?
+
What is the dot product of vector A(3, -2) and vector B(5, 4)?
+
What is the value of f(-1) for f(x) = 10^x and f(x) = e^x?
+
New questions in Mathematics
Y=-x^2-8x-15 X=-7
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?
-8+3/5
Consider the relation R defined on the set of positive integers as (x,y) ∈ R if x divides y. Choose all the true statements. R is reflexive. R is symmetric. R is antisymmetric. R is transitive. R is a partial order. R is a total order. R is an equivalence relation.
If L (-2, -5) reflected across y = -4. What are the coordinates of L?
A, B, C and D are numbers; If ABCD = 23, What is the result of ABCD BCDA CDAB DABC operation?
What’s 20% of 125?
A National Solidarity Bond offers A 5 year bond offering a gross return of 15% Calculate the AER for this investment. (Give your answer to two decimal places, no need for the percent or € sign in your answer)
is the x element (180,270), if tanx-3cotx=2, sinx ?
If the midpoint of point A on the x=3 line and point B on the y=-2 line is C(-2,0), what is the sum of the ordinate of point A and the abscissa of point B?
prove that if n odd integer then n^2+5 is even
There are four times as many roses as tulips in Claire’s garden. Claire picked half of the number of roses and 140 roses were left in the garden. How many roses and tulips were in the Garden the first?
Suppose you have a sample of 100 values from a population with mean mu = 500 and standard deviation sigma = 80. Given that P(z < −1.25) = 0.10565 and P(z < 1.25) = 0.89435, the probability that the sample mean is in the interval (490, 510) is: A)78.87% B)89.44% C)10.57% D)68.27%
A company receives sales in $20 per book and $18 per calculator. The per unit cost to manufacture each book and calculator are $5 and 4$ respectively. The monthly (30 day) cost must not exceed $27000 per month. If the manufacturing equipment used by the company takes five minutes to produce a book and 15 minutes to produce a calculator, how many books and calculators should the company produce to maximise profit? Please solve graphically and
Derivative of 2x
X^3 - x^2 - 4 = 0, what are the values of x?
y′ = 2x + 3y x′ = 7x − 4y x(0) = 2 y(0) = −1 sisteminin ¸c¨oz¨um¨un¨u bulunuz. (Lineer Denk. Sis.)
Identify the slope and y intercept y=11+2/3x
For how long does the principal amount of €7,537 bring the same interest as the principal amount of €12,345 invested for 8 months? Interest calculation is simple and decursive.
calculate the product of 4 and 1/8