作者在 2008-04-26 22:20:41 发布以下内容
#define N 5
#include<stdio.h>
void main()
{float score[5],sum=0,ave;
int i;
printf("Input score");
for(i=0;i<5;i++)
scanf("%f",&score[i]);
for(i=0;i<5;i++)
sum+=score[i];
ave=sum/5;
printf("sum=%4f,average=%4f",sum,ave);
}
#include<stdio.h>
void main()
{float score[5],sum=0,ave;
int i;
printf("Input score");
for(i=0;i<5;i++)
scanf("%f",&score[i]);
for(i=0;i<5;i++)
sum+=score[i];
ave=sum/5;
printf("sum=%4f,average=%4f",sum,ave);
}