#include <stdio.h>
#include <conio.h>
int main(void)
{
int counter;
int grade;
int total;
float average;
total=0;
counter=1;
printf ("enter grade, -1 to end:");
scanf ("%d",&grade);
while ( grade != -1){
total=total+grade;
counter=counter+1;
printf ("enter grade, -1 to end:");
scanf("%d",&grade);
}
if (counter != 0){
average=( float ) total / counter;
printf("class average is %.2f\n",average);
}
else {
printf("cuowu\n");
}
getch();
return 0;
}
//不过我不知道你在干什么!
//换句话说,我不知道你的程序干什么!