-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPrimeiroProjeto.java
76 lines (35 loc) · 1.51 KB
/
PrimeiroProjeto.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package primeiro_projeto;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.util.Scanner;
/**
*
* @author caio.alunos
*/
public class PrimeiroProjeto {
/**
* @param args the command line arguments
*
*/
public static void main(String[] args) throws UnsupportedEncodingException {
System.setOut(new PrintStream(System.out,true,"UTF-8"));
// Programa que lê quatro notas do usúario e informa a média final.
// Entrada de dados
Scanner sc = new Scanner (System.in);
System.out.print("Digite seu nome: ");
String nome = sc.nextLine();
System.out.print("Digite o pimeiro número: ");
int n1 = sc.nextInt();
System.out.print("Digite o segundo número: ");
int n2 = sc.nextInt();
System.out.print("Digite o terceiro número:");
int n3 = sc.nextInt();
System.out.print("Digite o quarto número: ");
int n4 = sc.nextInt();
sc.close();
//Processamento dos dados
int media = (n1 + n2 + n3 + n4)/4;
// Saída dos dados
System.out.println("Seu nome é: " + nome + " e sua média final é de: " + media);
}
}