Following is a program to Input Marks of Physics, Chemistry, Biology, Mathematics & Computer and calculate the percentage and grade :
Grade Table
Percentage >= 90% : Grade AA
Percentage >= 80% : Grade AB
Percentage >= 70% : Grade BB
Percentage >= 60% : Grade BC
Percentage >= 50% : Grade CC
Percentage >= 40% : Grade CD
Percentage < 40% : Grade FF
#include <stdio.h>
int main()
{
float p, c, m, b, comp, score, total, percentage;
// Maximum marks in all the subjects is 100.
printf("Enter the marks in physics ");
scanf("%f", &p);
printf("Enter the marks in chemistry ");
scanf("%f", &c);
printf("Enter the marks in math ");
scanf("%f", &b);
printf("Enter the marks in biology ");
scanf("%f", &m);
printf("Enter the marks in computer ");
scanf("%f", &comp);
score = p + c + m + b + comp;
percentage = (score / 500) * 100;
if (percentage >= 90)
{
printf("Grade AA");
}
else if (percentage >= 80)
{
printf("Grade AB");
}
else if (percentage >= 70)
{
printf("Grade BB");
}
else if (percentage >= 60)
{
printf("Grade BC");
}
else if (percentage >= 50)
{
printf("Grade CC");
}
else if (percentage >= 40)
{
printf("Grade CD");
}
else
{
printf("Grade FF");
}
return 0;
}
