Ans 10 Write a C Program to Input 5 subject marks of a student and find percentage, grade on the following slab: Percentage bet 81-100 A, 71-80 B, 61-70 C, 40-60 D, below 39 F. 1
#include<stdio.h>
int main()
{
int eng, hindi, math, sci, computer, total;
float per;
printf("Enter marks for English: ");
scanf("%d", &eng);
printf("Enter marks for Hindi: ");
scanf("%d", &hindi);
printf("Enter marks for Maths: ");
scanf("%d", &math);
printf("Enter marks for Science: ");
scanf("%d", &sci);
printf("Enter marks for Computer: ");
scanf("%d", &computer);
total = eng + hindi + math + sci + computer;
printf("\nTotal marks obtained is: %d\n",total);
per = total / 5.0;
printf("Percentage = %.2f\n",per);
if(per>81)
{
printf("A Grade");
}
else
{
if(per> 71)
{
printf("B Grade");
}
else
{
if(per>61)
{
printf("C Grade");
}
else
{
if(per>40)
printf("D Grade");
else
printf("Fail");
}
}
}
return 0;
}