#include
int main(){
int a[21],N,i;
float sum;
scanf("%d",&N);
for(i=0;i{
scanf("%d",&a[i]);
sum+=a[i];
}
printf("平均值为:%.2lf",1.0*sum/N);
return 0;
}
#include
void main()
{
int n;
double a[20],sum=0;
printf("输入数组长度\n");
scanf("%d",&n);
int i;
printf("输入%d个数值\n",n);
for ( i = 0 ; i < n ; i++ )
{
scanf("%lf",&a[i]);
sum += a[i];
}
printf("平均数为%.2f",sum/n);
}
/*
============================================================================
Name : C_test.c
Author :
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#include
#include
#include
int main(void) {
int n;
int n1;
int array[20];
double s=0;
int i=0;
scanf("%d",&n);
n1=n;
while(n1!=0){
scanf("%d",&array[i]);
i++;
n1--;
}
while(n1!=n){
s=(double)array[n1]+s;
n1++;
}
s=(double)s/n;
printf("%0.2f\n",s);
puts("end");
return EXIT_SUCCESS;
}