-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.java
More file actions
40 lines (30 loc) · 980 Bytes
/
Copy pathmain.java
File metadata and controls
40 lines (30 loc) · 980 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
34
35
36
37
38
39
40
import java.util.Scanner;
public class main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int studentLetterLength = input.nextInt();
int[] studentGrade = new int[studentLetterLength];
for (int i = 0; i < studentGrade.length; i++)
studentGrade[i] = input.nextInt();
int top = studentGrade[0];
for (int i = 0; i < studentGrade.length; i++)
{
if(top < studentGrade[i])
top = studentGrade[i];
}
for (int i = 0; i < studentGrade.length; i++)
{
System.out.print("Student" + i + " score is " + studentGrade[i] + " and grade is ");
if(studentGrade[i] >= top - 10)
System.out.print("A\n");
else if(studentGrade[i] >= top - 20)
System.out.print("B\n");
else if(studentGrade[i] >= top - 30)
System.out.print("C\n");
else if(studentGrade[i] >= top - 40)
System.out.print("D\n");
else
System.out.print("F\n");
}
}
}