#include
void main()
{
clrscr();
float grade,average,sum,a=0;
while(grade!=-1)
{
sum=sum+grade;
textcolor(LIGHTCYAN);cprintf("Enter grade; -1 to exit: ");
scanf("%f",&grade);
if(grade==-1){
printf("Average is %.2f\n",average=sum/a);}
a++;}
if(average>=95 && average<=100){
printf("Rated A");}
if(average>=85 && average<=94){
printf("Rated B");}
if(average>=75 && average<=84){
printf("Rated C");}
if(average<=74){
printf("Failed");}
getch();
}
No comments:
Post a Comment