-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogramtwo.java
More file actions
29 lines (27 loc) · 1.07 KB
/
programtwo.java
File metadata and controls
29 lines (27 loc) · 1.07 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
import java.util.Scanner;
public class programtwo {
public static void main(String[] args) {
Scanner sn = new Scanner(System.in);
System.out.println("Enter the Number of Subjects:");
int subno = sn.nextInt();
float tm = 0;
for (float j = 1; j <= subno; j++) {
System.out.printf("Enter the Subject %.0f marks (in 100):\n", j);
tm += sn.nextFloat();
}
sn.close();
System.out.printf("Total marks obtained is %.3f in %d .\n", tm, (subno * 100));
System.out.printf("Your average percentage in %d subject(s) is %.3f .\n", subno, (tm / subno));
if (tm / subno >= 90) {
System.out.println("Grade is A+.");
} else if (tm / subno >= 80) {
System.out.println("Grade is A.");
} else if (tm / subno >= 70) {
System.out.println("Grade is B+.");
} else if (tm / subno >= 60) {
System.out.println("Grade is B.");
} else {
System.out.println("You are Below 60.");
}
}
}