-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstdsystem.java
More file actions
42 lines (42 loc) · 1.08 KB
/
stdsystem.java
File metadata and controls
42 lines (42 loc) · 1.08 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
import java.util.*;
class task1
{
Scanner sc=new Scanner(System.in);
int sum=0;
int avg,i;
void read()
{
System.out.println("Enter the number of subjects: ");
int n=sc.nextInt();
int a[]=new int[n];
System.out.println("Enter the marks (out of 100): ");
for(i=0;i<n;i++)
{
a[i]=sc.nextInt();
sum+=a[i];
}
avg=(sum/n)*100;
}
void display()
{
System.out.println("Total Marks: "+sum);
System.out.println("Average percentage: "+avg);
System.out.println("Grades: ");
if(avg>=90)
System.out.println("O Grade");
else if(avg>=80 && avg<90)
System.out.println("A+ Grade");
else if(avg>=70 && avg<80)
System.out.println("A Grade");
else if(avg>=60 && avg<70)
System.out.println("B+ Grade");
else
System.out.println("Needs Improvement");
}
public static void main(String args[])
{
task1 obj=new task1();
obj.read();
obj.display();
}
}