Marks Grading system

1 min read
Table of contents

Explanation:
Take the marks of each subject
and give them the grading
according to their Marks
.
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
System.out.print("Enter Telugu Marks = ");
int telugu = sc.nextInt();
System.out.print("Enter Hindi Marks = ");
int hindi = sc.nextInt();
System.out.print("Enter English Marks = ");
int english = sc.nextInt();
System.out.print("Enter Maths Marks = ");
int maths = sc.nextInt();
System.out.print("Enter Scicnce Marks = ");
int science = sc.nextInt();
System.out.print("Enter Social Marks = ");
int social = sc.nextInt();
int toatlmarks = telugu + hindi + english + maths + science + social;
int avg = toatlmarks / 6;
System.out.println("Total Marks = " + toatlmarks);
System.out.println("Avg Marks = " + avg);
if(avg > 90){
System.out.println("Excellent Grade");
}
else if(avg >80 && avg<=90){
System.out.println("A Grade");
}
else if(avg > 70 && avg<=80){
System.out.println("B Grade");
}
else if(avg> 60 && avg <=70){
System.out.println("C Grade");
}
else if(avg > 50 && avg <=60){
System.out.println("D Grade");
}
else{
System.out.println("F Grade == Failed");
}
}
}
0
Subscribe to my newsletter
Read articles from Madhu Palle directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Madhu Palle
Madhu Palle
IIIT - N Software Geek. Startup Enthusiast. Build for the Future.