-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEx03.java
More file actions
48 lines (40 loc) · 1.15 KB
/
Ex03.java
File metadata and controls
48 lines (40 loc) · 1.15 KB
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
import java.util.Scanner;
public class Ex03 {
private static String[] intevalo;
public static void main(String[] args) {
int[] notas = new int[20];
int [] intervalo = new int[5];
int alunos = 1;
Scanner ler = new Scanner(System.in);
for (int i=0;i<notas.length;i++){
System.out.println("Aluno:"+alunos+" Informe a sua nota de 1 a 5 "
+ "(sendo 1 ruim e 5 excelente): ");
notas[i] = ler.nextInt();
alunos++;
}
for (int i = 0; i < notas.length; i++) {
for(int j=0;j<intervalo.length;j++) {
if (notas[i]==1){
intervalo[j]++;
}
if (notas[i]==2){
intervalo[j]++;
}
if (notas[i]==3){
intervalo[j]++;
}
if (notas[i]==4){
intervalo[j]++;
}
if (notas[i]==5){
intervalo[j]++;
}
}
}
for (int i=0;i<intervalo.length;i++){
int j=1;
System.out.println("quantidade de notas"+j+":"+intervalo[i]);
j++;
}
}
}