-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDezesseis.java
More file actions
33 lines (26 loc) · 787 Bytes
/
Copy pathDezesseis.java
File metadata and controls
33 lines (26 loc) · 787 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
29
30
31
32
33
package TodosExecicios;
//16.Façaumprogramaqueleiaumarraydenúmerosdousuário
//atéqueousuárioinsiraumnúmeroigualaoprimeironúmerolido.
import java.util.ArrayList;
import java.util.Scanner;
public class Quinze {
public static void main (String []args) {
ArrayList<Integer> maiores = new ArrayList<>();
Scanner sc = new Scanner(System.in);
Integer guardar = Integer.MIN_VALUE;
int cont = 0;
System.out.println("Digite uum número igual o primeiro para encerrar. ");
while(true) {
System.out.println("Informe números: ");
Integer maior = sc.nextInt();
maiores.add(maior);
if (guardar == maiores.get(cont)) {
break;
}
guardar = maiores.get(0);
cont++;
}
System.out.println("Foram informados " + cont + " números.");
sc.close();
}
}