C语言编程题,求解
1个回答
展开全部
#include <stdio.h>
int main ( )
{
float a[10],v_mean,v_big,v_small;
int i,n;
printf("input 10 data:\n");
for (i=0;i<10;i++)scanf("%f",&a[i]);
//part7:
v_mean=0;
for (i=0;i<10;i++) v_mean=v_mean+a[i];
v_mean=v_mean/10.0;
printf("mean is %f\n",v_mean);
//part8:
n=0; v_big=a[0];
for (i=0;i<10;i++){
if (a[i]>v_big) {n=i; v_big=a[i];};
}
printf("max is %f, i is %d\n",v_big,n);
////part9:
n=0; v_small=a[0];
for (i=0;i<10;i++){
if (a[i]<v_small) {n=i; v_small=a[i];};
}
printf("min is %f, i is %d\n",v_small,n);
return 0;
}
int main ( )
{
float a[10],v_mean,v_big,v_small;
int i,n;
printf("input 10 data:\n");
for (i=0;i<10;i++)scanf("%f",&a[i]);
//part7:
v_mean=0;
for (i=0;i<10;i++) v_mean=v_mean+a[i];
v_mean=v_mean/10.0;
printf("mean is %f\n",v_mean);
//part8:
n=0; v_big=a[0];
for (i=0;i<10;i++){
if (a[i]>v_big) {n=i; v_big=a[i];};
}
printf("max is %f, i is %d\n",v_big,n);
////part9:
n=0; v_small=a[0];
for (i=0;i<10;i++){
if (a[i]<v_small) {n=i; v_small=a[i];};
}
printf("min is %f, i is %d\n",v_small,n);
return 0;
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询