Java Program to grade calculation system

Get a mark of a student and find its grade. (Note: 96 to 100 - O Grade 91 to 95 - A Grade 81 to 90-B Grade 71 to 80 - C Grade 61 to 70 - D Grade 50 to 60 - E Grade Below 50 - F Grade)

Sample Input 1:

75

Sample Output 2:

C Grade

Flow Chart Design

Java Program to grade calculation system Flow Chart

Try your Solution

Strongly recommended to Solve it on your own, Don't directly go to the solution given below.

public class Hello { public static void main(String args[]) { //Write your code here } }

Program or Solution

				
			
					
import java.util.*;
class Grade
{
  public static void main(String args[])
  {
        int mark;
	Scanner sc=new Scanner(System.in);
	System.out.println("Enter The Mark:");
	mark=sc.nextInt();
	if(mark>95&&mark<=100)
	{
		System.out.println("O Grade");
	}
	else if(mark>90&&mark<=95)
	{
		System.out.println("A grade");
	}
	else if(mark>80&&mark<91)
	{
		System.out.println("B Grade");
	}
	else if(mark>70&&mark<81)
	{
		System.out.println("C Grade");
	}
	else if(mark>60&&mark<71)
	{
		System.out.println("D Grade");
	}
	else if(mark>49&&mark<61)
	{
		System.out.println("E Grade");
	}
	else if(mark>=0&&mark<50)
	{
		System.out.println("F Grade");
	}
	else
	{
		System.out.println("Invalid Mark");
	}
  }
}
			
				
			

Program Explanation

chained conditional check is used here to check the mark range.

any one of the grade will be displayed using else if Statement.

Comments