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: Find the absolute maximum and minimum values of the function f(x) = x^3 + 2x^2 - 5x on the interval [-2, 2].
+
Question: What is the derivative of f(x) = 3x^2 + 2x - 5?
+
What is the limit of (x^2 + 3x - 2) / (4x^2 + 5x - 1) as x approaches 2?
+
New questions in Mathematics
calculate the derivative by the limit definition: f(x) = 6x^3 + 2
Solution of the equation y'' - y' -6y = 0
find the value of the tangent if it is known that the cos@= 1 2 and the sine is negative. must perform procedures.
-8+3/5
The random variable Y is defined as the sum between two different integers selected at random between -4 and 2 (both included). What are the possible values of the random variable Y? What is the value of P(Y=-3)? And whether it is less than or equal to -5?
A drawer contains three pairs of white socks, five pairs of black socks and two pairs of red socks. Caden randomly selects two pairs of socks on his way to the gym. What is the probability that both pairs of socks are black?
A juice shop prepares assorted juices, for their juices they have 5 different types of fruit. How many types of assortments can be prepared in total, if it is considered an assortment to a juice made with two or more fruits?
Find the root of x^4-10x^ 5=0 using Newton's method, with a precision of the smallest positive root.
The function g:Q→Q is a ring homomorphism such that g(3)=3 and g(5)=5. What are the values of g(8) and g(9)?
Find the equation of the line perpendicular to −5𝑥−3𝑦+5=0 passing through the point (0,−2)
Substitute a=2 and b=-3 and c=-4 to evaluate 2ac/(-2b^2-a)
form a key for your lock containing the numbers 2 2 5 8 How many different keys can you form?
Calculate the boiling temperature and freezing temperature at 1 atmosphere pressure of a solution formed by dissolving 123 grams of ferrous oxide in 1.890 grams of HCl.
How many square feet of floor area are there in three two-storey apartment houses, each of which is 38 feet wide and 76 feet long?
How to do 15 x 3304
At the dance there are 150 boys the rest are girls. If 65% are girls what is the total amount in the room
Determine a general formula​ (or formulas) for the solution to the following equation.​ Then, determine the specific solutions​ (if any) on the interval [0,2π). cos30=0
In poker, a full house consists of five cards, where two of the cards have the same number (or letter) and the remaining three also have the same number (or letter) as each other (but not as the previous two cards). Use a search engine or Wikipedia to understand the concept better if necessary. In how many different ways can one obtain a full house?
7-1=6 6x2=12 Explain that
A grain silo has a height of 8.8m with a 11.4m diameter. If it is filled 0.5% of it's volume, how much grain (m^3) is stored in the silo? (0 decimal places)