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 integral of f(x) = 3x^2 + 5x - 2 over the interval [0, 2] using the definition of definite integrals?
+
What is the solution to the inequality: 3x - 5 > 10?
+
Math question: Find the value of the tangent of angle A if the adjacent side is 3 and the opposite side is 4.
+
New questions in Mathematics
calculate the derivative by the limit definition: f(x) = 6x^3 + 2
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)
𝑦 = ( 𝑥2 − 3) (𝑥3 + 2 𝑥 + 1)
Investing equal amounts of money into each of five business ventures Let&#39;s say you plan. 20 to choose from If there are initiatives, how many different ones among 20 initiatives? five startups can be selected?
Suppose a large shipment of cell phones contain 21% defective. If the sample of size 204 is selected, what is the probability that the sample proportion will differ from the population proportion by less than 4% round your answer to four decimal places
A regional candy factory sells a guava roll at a price of $48, the monthly fixed costs amount to $125,000 and the variable cost for making a guava roll is $28. Determine: a) The equation of the total income from the production of guava rolls.
How long will it take for $900 to become $5000 at an annual rate of 11.15% compounded bimonthly?
If f(x,y)=6xy^2+3y^3 find (∫3,-2) f(x,y)dx.
-3(-4x+5)=-6(7x-8)+9-10x
2x+4x=
Calculate the value of a so that the vectors (2,2,−1),(3,4,2) and(a,2,3) are coplanar.
Exercise 1 An ejidal association wishes to determine the distribution for the three different crops that it can plant for the next season on its available 900 hectares. Information on the total available and how many resources are required for each hectare of cultivation is shown in the following tables: Total available resource Water 15,000 m3 Fertilizer 5,000 kg Labor 125 day laborers Requirements per cultivated hectare Corn Soybeans Wheat Water 15 25 20 Fertilizer 5 8 7 Labor** 1/8 1/5 1/4 *The data in fraction means that with one day laborer it will be possible to care for 8, 5 and 4 hectares respectively. * Sales of crops 1 and 3, according to information from the Department of Agriculture, are guaranteed and exceed the capacity of the cooperative. However, soybeans must be limited to a maximum of 150 hectares. On the other hand, the profits for each hectare of crop obtained are estimated at: $7,500 for corn, $8,500 for soybeans and $8,000 for wheat. The objectives are to determine: • How many hectares of each crop must be allocated so that the profit is maximum. R= • The estimated profits for the ejidal cooperative in the next growing season. R=
Use a pattern approach to explain why (-2)(-3)=6
If the regression equation is given by 4x –y + 5 = 0, then the slope of regression line of y on x is
X~N(2.6,1.44). find the P(X<3.1)
A hardware bill totals $857.63 with discounts of 5% and 3%. What is the net cost of the Material ?
A diamond ring was reduced from $999.99 to $689.99. Find the percent reduction in the price. Round the answer to the nearest tenth of a percent, if necessary.
(6²-14)÷11•(-3)
2 - 6x = -16x + 28
An invoice for €2,880 plus default interest of €48.40 was paid on October 28th. Interest rate 5.5%. When was the bill due?