0
Make a program that receives two numbers and perform one of the operations listed below according to the user’s choice. If an invalid option is typed show error message and end script execution. The options are: 1. Average between the two numbers. 2. Difference between the greater and the lesser. 3. The product between the two numbers.
Nome:Exercicio6
Objetivo:mostrar a mensagem de erro
Dados de entrada:
Saida: dois numeros
Variaveis: TA CERTO DESSE JEITO QUE MAIS
EU FAÇO SEI LA
inteiro num1
inteiro num2
inteiro opcão
Inicio
Leia num1
Leia num2
Leia opcão
You already know the
if-else
(orse-então
)? And theleia
? Then read the choice of number and put it into a variable. If that choice is 1, do one thing, if it is 2 do another and if it is 3, do the third thing.– Victor Stafusa
The goal is not to show an error message, as there is nothing that can be called an error here. You’ve already started well, now the next step is to put the set of
se-então-senão
correct checking the options. Then, for eachentão
you make the corresponding calculation and show the result on the screen.– Victor Stafusa