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)
Math question: What is the probability of rolling a 3 on a fair six-sided die?
+
What is the formula to find the standard deviation?
+
What is the value of y when x = 5 in the circle function x² + y² = 9?
+
New questions in Mathematics
Find an arc length parameterization of the curve that has the same orientation as the given curve and for which the reference point corresponds to t=0. Use an arc length s as a parameter. r(t) = 3(e^t) cos (t)i + 3(e^t)sin(t)j; 0<=t<=(3.14/2)
a ferry travels 1/6 of the distance between two ports in 3/7 hour. The ferry travels at a constant rate. At this rate, what fraction of the distance between the two ports can the ferry travel in one hour.
String x = 5 Int y=2 System.out.println(x+y)
I) Find the directional derivative of 𝑓(𝑥, 𝑦) = 𝑥 sin 𝑦 at (1,0) in the direction of the unit vector that make an angle of 𝜋/4 with positive 𝑥-axis.
Derivative of x squared
What is the r.p.m. required to drill a 13/16" hole in mild steel if the cutting speed is 100 feet per minute?
-3x 2y = -6; -5x 10y = 30
Identify a pattern in the list of numbers.Then use this pattern to find the next number. 37,31,25,19,13
is the x element (180,270), if tanx-3cotx=2, sinx ?
4x + 8y = 5 2x + 4y = 10
20% of 3500
Task 1 angel has 3 quarters 3/8 of a tank of gasoline and Miguel 7/8, who has more gasoline? number line on number line
Calculate the minimum size of a simple random sample assuming a sampling error of 5% assuming that the population size is 100 elements
cube root of 56
A natural gas company has a fixed rate of 1,320 pesos plus 1,590 pesos per cubic meter of gas consumed monthly per customer. Indicate the cost function to determine the value in pesos of the cubic meters of gas consumed in a month per customer. How much did a customer who consumed 18 cubic meters of gas pay? If a customer paid 34,710 pesos, how many cubic meters of gas did he consume?
Find the vertex F(x)=x^2-10x
Log0
A 20,000 kg school bus is moving at 30 km per hour on a straight road. At that moment, it applies the brakes until it comes to a complete stop after 15 seconds. Calculate the acceleration and the force acting on the body.
4m - 3t + 7 = 16
Let A denote the set of all people who were alive in 2010. Let B denote the set of all real numbers. Let f assign, to each person in A, their weight during the year 2010. Is f a function? Explain in complete sentences.