File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
OOP/Creating my first application/3) Listas e Loops Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ // Escrever uma função que a partir de 2 números de ponto flutuante A e B exiba no console o resultado
2+ // de suas 4 operações matemáticas básicas (soma, subtração, multiplicação e divisão), utilizando a
3+ // interpolação de strings.
4+
5+ using System ;
6+ class Program {
7+
8+ static string Calculo ( float a , float b ) {
9+ float soma = a + b ;
10+ float subtracao = a - b ;
11+ float multiplicacao = a * b ;
12+ float divisao = a / b ;
13+
14+ return $ "Soma: { soma } \n Subtração: { subtracao } \n Multiplicação: { multiplicacao } \n Divisão: { divisao } ";
15+ }
16+
17+ static void Main ( string [ ] args ) {
18+ Console . WriteLine ( "Digite um número: " ) ;
19+ float a = float . Parse ( Console . ReadLine ( ) ) ;
20+
21+ Console . WriteLine ( "Digite outro número: " ) ;
22+ float b = float . Parse ( Console . ReadLine ( ) ) ;
23+
24+ string resultado = Calculo ( a , b ) ;
25+ Console . WriteLine ( resultado ) ;
26+ }
27+ }
You can’t perform that action at this time.
0 commit comments