#include<stdio.h>
main()
{
int score[5];
int totalScore=0;
int i;
printf("Input the scores of ten students:\n");
for(i=0;i<5;i++)
{
scanf("%d",&score[i]);
totalScore=totalScore+score[i];
}
printf("The average score is %f\n",totalScore/5.0);
return 0;
}
运行结果:
知识点:
数组的下标
心得体会:
知道了变量i的作用是保存数组下标