include <stdio.h>int sum(int str[10]){int i,sum=0;for(i=0;i<10;i++) sum+=str[i];return sum;}double avg(int sum){return(sum/10.0);}void main(){int i,j,str[10];double k;for(i=0;i<10;i++)scanf("%d",&str[i]);j=sum(str);k=avg(j);printf("和:%d\...
include <stdio.h>int sum(int a[]){int i,s=0;for(i=0;i<10;i++)s+=a[i];return s;}double aver(int a[]){return sum(a)/10.0;}int main(){int i,a[10];for(i=0;i<10;i++)scanf("%d",&a[i]);printf("和:%d\n平均值:%f",sum(a),aver(a));return 0;}/...
int i;printf("输入数组的元素个数 n :\n");scanf("%d",&n);printf("依次输入n个元素:\n");for(i=0;i<n;i++)scanf("%lf",&array[i]);printf("平均值:\n");printf("%.3lf\n",getAverage(array));return 0;}
main(){ int a,b,c,d,e,f,g,h,i,j,s;scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",&a,&b,&c,&d,&e,&f,&g,&h,&i,&j);s=a+b+c+d+e+f+g+h+i+j;printf("结果是%d\n,"s);}
"请输入数组元素个数(1<=N<=100):");scanf("%d",&N); }while(N<1 || N>100); //int a[100];int *a = new int[N]; for(i=0;i<N;i++) { a[i] = 0; } printf("请依次输入数组元素的值,以空格或Tab分隔:"); for(...
include <stdlib.h> include <string.h> float b(float arr[],int n); //<<<少了函数声明 void main(){ float a[50];int i,n=0;for(i=0;getchar()!='\n';i++){ scanf("%f",&a[i]);n++;} printf("平均值是:%f",b(a,n) ); //<<<b这个函数传的是数组的首地址...
printf("该学生的平均成绩为:%f\n",avg);} int main(){ int i;float score[10];for(i = 0;i < 10; i++){ printf("请输入第%d门课程成绩:",i + 1);scanf("%f",&score[i]);} /*调用求平均值函数*/ get_avg(score,10);} 在C-free下调试通过,希望对LZ所有帮助!欢迎加QQ...
{ float deg[N];printf("输入该门课程的成绩: \n");for(int i=0;i<N;i++)scanf("%f",°[i]);printf("该门课程的平均值为: %0.2f\n",aver(deg));printf("该门课程的最高分为: %0.2f\n",Max(deg));printf("该门课程的最低分为: %0.2f\n",Min(deg));return 0;} ...
程序代码如下:include <stdio.h> int main(){ int a,b,c,average;printf("a=");scanf("%d",&a);printf("b=");scanf("%d",&b);printf("c=");scanf("%d",&c);average=(a+b+c)/3;printf("a,b,c3个数字的平均值:%d",average);} ...
include <bits/stdc++.h>#define LDB long doubleusing namespace std; LDB count(int a[]){ LDB tot=0; for (int i=0;i<10;i++) tot+=a[i]; tot/=10; return(tot); } int main(){ int arr[10]; printf("%.3Lf\n",count(arr)); } ...