In this program, You will take five subject marks from the user, then calculate an average of five subject marks and print grades according to their five subject average marks and printing their percentage.
C program to calculate percentage of 5 subjects
printf("\n enter marks obtain in five subject:");
printf("\naverage is %f",avg);
printf("\n your grade is");
printf("\n your percentage is %f",percentage);
enter marks obtain in five subject:50
average is 62.000000
your grade is C
your percentage is 62.000000
Algorithm to calculate grade and percentage of five subject
This algorithm will find the percentage and grade of students in five subjects.
Take input of 5 subject marks from user and store in phy, chem, eng, math, and comp.
Calculate the total mark obtain in all five subjects and store it in the sum variable i.e sum=phy+chem+eng+math+comp.
Divide the sum of all subjects by the total number of subjects to find the average i.e. avg = total / 5.
For calculating percentages use the formula which is, percentage=(sum/500)*100.
Now print the grade by using an if-else statement.