In this video, we will write a C Program to Calculate the Grade of Students. So the task is in given integer array marks, which comprises marks scored by a student( out of 100) in different subjects and assign a grade to the student. The grade is found out by taking the percentage of the marks scored by the student.
The grade is calculated using the formula = Total number of marks scored/ Maximum number of all marks
Examples:
Input
Marks = { 55, 65, 46, 58, 78, 65}
Output: Grade C
Input marks = { 95, 88, 98, 98, 92, 96}
Output: Grade A
Basic Algorithm:
- First Initialize a variable to sum all the marks scored by the student, total to 0.
- Then Initialize a variable to store the grade of the student, grade to ‘ F ’.
- Now, we iterate through the marks array and find the total marks scored by the student.
- We apply the formula described above to calculate the percentage.
- We also make nested if else or Switch case statements to construct to assign proper grades to the student.