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 measure of angle ABD if angle ABC measures 80 degrees and angle CBD measures 60 degrees?
+
What is 2 to the power of 5 multiplied by the cube root of 125?
+
Math question: What is the factored form of the quadratic equation x^2 + 7x + 12?
+
New questions in Mathematics
How to find the value of x and y which satisfy both equations x-2y=24 and 8x-y=117
A college believes that 22% of applicants to that school have parents who have remarried. How large a sample is needed to estimate the true proportion of students who have parents who have remarried to within 5 percentage points?
STUDENTS IN A CLASS LEARN ONLY ONE FOREIGN LANGUAGE. two-sevenths of the students learn German, half of the students learn Spanish, and the remaining six students learn Italian. what is the number of students in this class? detail your reasoning carefully.
(6.2x10^3)(3x10^-6)
x/20*100
There are 162 students enrolled in the basic mathematics course. If the number of women is 8 times the number of men, how many women are there in the basic mathematics course?
12(3+7)-5
7. Find the equation of the line passing through the points (−4,−2) 𝑎𝑛𝑑 (3,6), give the equation in the form 𝑎𝑥+𝑏𝑦+𝑐=0, where 𝑎,𝑏,𝑐 are whole numbers and 𝑎>0.
A triangular window has a base of 6 ft. and a height of 7 ft. What is its area?
A box of numbered pens has 12 red, 12 blue, 12 green and 12 yellow pens. The pens for each colour are numbered from 1 to 12. There is a unique number on each pen, so no pen is exactly the same as any other pen in the box. When reaching into the box to randomly draw five pens without replacement, what is the proportion of getting exactly four pens of the same colour (Note: the numbers matter but the order does not)?
The sick-leave time of employees in a firm in a month is normally with a mean of 100 hours and a standard deviation of 20 hours. Find the probability that the sick-leave time of an employee in a month exceeds 130 hours.
1. A capital of $3,831 was lent, and it has produced interest of $840 from 05-12-2022 to 1-12-2023. At what annual simple interest rate was the capital lent?
Next%C3%B3n%2C+we+are+given+a+series+of+Tri%C3%A1angles+Right%C3%A1angles+%3Cbr%2F%3Ey+in+each+one+of+them+ are+known+2%28two%29+measurements+of+sides.+%3Cbr%2F%3Elet's+determine+all+trigonom%C3%A9tric+ratios.
A Smooth Plane is listed for $195.00. Discounts of 12% and 10% are allowed. If the customer pays cash within 30 days, an additional discount of 3% is granted. What is the cost if a carpenter takes advantage of all the discounts offered?
3%2B2
36 cars of the same model that were sold in a dealership, and the number of days that each one remained in the dealership yard before being sold is determined. The sample average is 9.75 days, with a sample standard deviation of 2, 39 days. Construct a 95% confidence interval for the population mean number of days that a car remains on the dealership's forecourt
The mass of 120 molecules of X2C4 is 9127.2 amu. Identify the unknown atom, X, by finding the atomic mass. The atomic mass of C is 12.01 amu/atom
Pablo has a balance of $440,000 and 2/5 of the money is used to pay bills. How much money do you have left after paying the bills?
Below are three 95% CIs (where 𝜎 was known and 𝑥̅happened to be the same); one with sample size 30, one with samplesize 40, and one with sample size 50. Which is which?(66.2, 76.2)(61.2, 81.2)(56.2, 86.2)
It costs a manufacturer $2,500 to purchase the tools to manufacture a certain homemade item. If the cost for materials and labor is 60¢ per item produced, and if the manufacturer can sell each item for 90¢, find how many items must he produce and sell to make a profit of $2000?