Sorry I copied the earlier version, I should have double chk...

this is the correct version it will compile.

Hello I have an assignment; this is an example of what the output should be:

Enter Grade 1: 97

Enter Grade 2: 45

Enter Grade 3: 76

Enter Grade 4: 345

Sorry, thats an incorrect value try again

Enter Grade 4: 99

Enter Grade 5: 999

*(an x is marked for each grade range.) *

Result

Grade 95-100: xx

Grade 90-94:

etc

My code works its just that my professor wants it to be done in 11 functional lines, is this possible? If anyone has any idea I would appreciate.

Code:

#include <stdio.h>
main()
{
int count[101], y, grade, x;
int A=0, B=0, C=0, D=0, F=0;
int AB=0, BC=0, CD=0, DF=0;
printf(\n\n | Grade System | \n);
printf(-----------------------------------------------\n\n);
while (grade!= 999)
{
for (y=0; y<=100; ++y)
count[y]=0;
printf(\n Please input Grades 0 100, to see results or exit program type 999\n\n);
for(y=0; y<=99; ++y)
{
printf(Grade: );
scanf(%i, &grade);
if (grade == 999)
y=100;
else if (grade <0 || grade >100)
{
printf(\n Sorry, that is incorrect value, to see result or exit program type 999 \n\n);
--y;
}
else
++ count[grade];
}
for(y=100; y>=95; --y)
A=A+count[y];
for(; y>90; --y)
AB=AB+count[y];
for(; y>85; --y)
B=B+count[y];
for(; y>80; --y)
BC=BC+count[y];
for(; y>75; --y)
C=C+count[y];
for(; y>70; --y)
CD=CD+count[y];
for(; y>65; --y)
D=D+count[y];
for(; y>60; --y)
DF=DF+count[y];
for(; y>0; --y)
F=F+count[y];
printf(\n 95-100: );
for(x=A; x>0; --x)
printf(x);
printf(\n 90-94: );
for(x=AB; x>0; --x)
printf(x);
printf(\n 85-89: );
for(x=B; x>0; --x)
printf(x);
printf(\n 80-84: );
for(x=BC; x>0; --x)
printf(x);
printf(\n 75-79: );
for(x=C; x>0; --x)
printf(x);
printf(\n 70-74: );
for(x=CD; x>0; --x)
printf(x);
printf(\n 65-69: );
for(x=D; x>0; --x)
printf(x);
printf(\n 60-64: );
for(x=DF; x>0; --x)
printf(x);
printf(\n 0-59: );
for(x=F; x>0; --x)
printf(x);
printf(\n -------------- | End Program/Results | -------------- \n);
}
}