CALCULATE GRADE in C Programming
Code:
#include<stdio.h>
int main()
{
int a,b,c,avg=0;
scanf("%d", &a);
scanf("%d", &b);
scanf("%d", &c);
avg=(a+b+c)/3;
if(avg>=90)
printf("The grade is A");
else if ((avg>=80)&&(avg<90))
printf("The grade is B");
else if ((avg>=70)&&(avg<80))
printf("The grade is C");
else if((avg>=60)&&(avg<70))
printf("The grade is D" );
else if((avg>=50)&&(avg<60))
printf("The grade is E");
else if(avg<50)
printf("The grade is F");
return 0;
}
No comments