#include
#include
#define MAXNUMBER 10
//#define debug
int main(void)
{
int score[MAXNUMBER];
int STUNO, SUBNO;
int average;
int i, j;
int total ;
printf("Please input student number and subject number!\n");
printf("The students number is:"); scanf("%d",&STUNO);
printf("The subjects number is:"); scanf("%d",&SUBNO);
#ifdef debug
printf("%d,%d\n",STUNO,SUBNO);
#endif
for(j = 1;j <= STUNO; j++)
{
memset(score,0,MAXNUMBER * sizeof(int));
total = 0;
average = 0;
for(i=1;i <= SUBNO; i++)
{
printf("Please input %d subject score:",i);
scanf("%d", &score[i]);
}
for(i = 1;i<=SUBNO;i++)
{
total += score[i];
#ifdef debug
printf("%d\n",score[i]);
#endif
}
#ifdef debug
printf("%d\n",total);
printf("%d\n",SUBNO);
#endif
average =total/SUBNO;
printf("The %d average score is: ", j);
printf("%d\n",average);
}
return 0;
}
阅读(1395) | 评论(0) | 转发(0) |