-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGRADE_MARKS.java
More file actions
40 lines (37 loc) · 1.46 KB
/
GRADE_MARKS.java
File metadata and controls
40 lines (37 loc) · 1.46 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
package GRADE;
import java.util.Scanner;
public class GRADE_MARKS {
public static void main(String[]args){
Scanner sc = new Scanner (System.in);
System.out.println("Enter marks of English");
int eng = sc.nextInt();
System.out.println("Enter marks of Maths");
int math = sc.nextInt();
System.out.println("Enter marks of Physics");
int phy = sc.nextInt();
System.out.println("Enter marks of Chemistry");
int chem = sc.nextInt();
System.out.println("Enter marks of Hindi");
int hindi = sc.nextInt();
int sum = eng+math+phy+chem+hindi;
//calculate percentage
double percentage = (sum*100.0)/500;
System.out.println(sum);
System.out.println("You scored "+ percentage +" %");
if(percentage >= 90){
System.out.println("Your grade = A" );
}
else if(percentage >= 70 && percentage<=90){
System.out.println("Your grade = B" );
}
else if(percentage >= 60 && percentage<=70){
System.out.println("Your grade = C" );
}
else if(percentage >= 40 && percentage<=60){
System.out.println("Your grade = D" );
}
else {
System.out.println("Your grade = F" );
}
}
}