-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEx_02.java
More file actions
23 lines (18 loc) · 775 Bytes
/
Copy pathEx_02.java
File metadata and controls
23 lines (18 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import java.util.Scanner;
public class Ex_02 {
public static void main(String[] args) throws Exception {
Scanner leitor = new Scanner(System.in);
System.out.println("========== Calcula Média & Soma ==========");
System.out.print("Digite o primeiro número: ");
float n1 = leitor.nextFloat();
System.out.print("Digite o segundo número: ");
float n2 = leitor.nextFloat();
System.out.print("Digite o terceiro número: ");
float n3 = leitor.nextFloat();
float soma = n1 + n2 + n3;
float media = soma/3;
System.out.println("A soma é: " + soma);
System.out.println("A média é: " + media);
System.out.println("==========================================");
}
}