#include<stdio.h>
main()
{
int i,score,sum=0;
int A=0,Bplus=0,B=0,Cplus=0,C=0,Dplus=0,D=0,F=0;
for(i=1;i<=20;i++)
{
printf("Input Score %d:",i);
scanf("%d",&score);
sum=sum+score;
if(score >=80)
{
A=A+1;
}else if(score >=75)
{
Bplus=Bplus+1;
}else if(score >=70)
{
B=B+1;
}else if(score >=65)
{
Cplus=Cplus+1;
}else if(score >=60)
{
C=C+1;
}else if(score >=55)
{
Dplus=Dplus+1;
}else if(score >=50)
{
D=D+1;
}else
{
F=F+1;
}
}
printf("Grade A=%d\n",A);
printf("Grade B+=%d\n",Bplus);
printf("Grade B=%d\n",B);
printf("Grade C+=%d\n",Cplus);
printf("Grade C=%d\n",C);
printf("Grade D+=%d\n",Dplus);
printf("Grade D=%d\n",D);
printf("Grade F=%d\n",F);
sum=sum/20;
if(sum>=80)
{
printf("Grade Average is A\n");
}else if(sum>=75)
{
printf("Grade Average is B+\n");
}else if(sum>=70)
{
printf("Grade Average is B\n");
}else if(sum>=65)
{
printf("Grade Average is C+\n");
}else if(sum>=60)
{
printf("Grade Average is C\n");
}else if(sum>=55)
{
printf("Grade Average is D+\n");
}else if(sum>=50)
{
printf("Grade Average is D\n");
}else
{
printf("Grade Average is F\n");
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.