In this tutorial, we will write a java program to calculate the grade of the student. Before that, you should have knowledge on the following topic in java:

Java Program to calculate and display Student Grades: The program simply takes a user input for the number of subjects and then for the marks obtained on each of those subjects.

Then the sum of the marks is calculated and then the average of that sum is calculated. The average is calculated by dividing the sum of the marks by the number of subjects. Lastly, using the if-else ladder the grade is displayed on the screen.

• If marks > 80, Grade is A
• If marks > 60 and <= 79, Grade is B
• If marks > 40 and <= 59, Grade is C

You can change the grades according to your need and your question. We will perform two different programs:

2. Using Switch Case

## Java program to find grade of a student using if else ladder

Output:

`Enter the number of subjects: 5Enter Marks for 5 Subjects:5584726790Your Grade: B`

## Java Program to find grade of a student using switch case

`Enter the Number of Subjects:4Enter Marks for 4 Subjects:84799285Percentage Obtained: 85.0Your Grade: A`

### Find the output ab, cd, ef, g for the input a,b,c,d,e,f,g in Javascript and Python

In this tutorial, we will write a program to find a pairs of elements from an array such that for the input [a,b,c,d,e,f,g] we will …

### String Pattern Programs in C

In this tutorial, we will write various C pattern programs for String. Before that, you may go through the following topics in C. for loop …

### Java Program to Find pair of Integers in Array whose sum is given Number

In this tutorial, we will write a program to find a pair of elements from an array whose sum equals a given number in java …

### Program to Print Diamond Alphabet Patterns in C

In this tutorial, we will learn to write a C program to print Diamond patterns using alphabets/characters. However, in this tutorial, we will create a …

### Half Diamond Pattern in C using Alphabets

In this tutorial, we will learn and code the half diamond alphabet patterns in C programming language. However, in this tutorial, we will create a …

### Half Pyramid of Alphabets in C

In this tutorial, we will learn and code alphabet patterns in C programming language specifically the Half pyramid of alphabets in C programming. However, in …