-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathseis.java
More file actions
28 lines (22 loc) · 804 Bytes
/
seis.java
File metadata and controls
28 lines (22 loc) · 804 Bytes
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
import java.util.Scanner;
public class seis {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int contador = 0;
int maior1 = Integer.MIN_VALUE;
int maior2 = Integer.MIN_VALUE;
while (contador < 10) {
System.out.print("Digite o número " + (contador + 1) + ": ");
int numero = scanner.nextInt();
contador++;
if (numero > maior1) {
maior2 = maior1;
maior1 = numero;
} else if (numero > maior2) {
maior2 = numero;
}
}
System.out.println("Os dois maiores números digitados são: " + maior1 + " e " + maior2);
scanner.close();
}
}