当前位置:首页 > 中国海洋大学C语言程序2015春季学期上机题考试题及答案
if(i==0||i==(m-1)) {
for(j=0;j else sum+=p[i][0]+p[i][N-1]; } return sum; } void main() {int a[4][N]={{3,2,5,4,2},{6,2,3,9,1},{4,6,1,8,6},{7,6,5,4,2}}; printf(\ NONO(); } 4. 编写函数 int fun(float *p,int n) , 功能:统计有n个数据的一维数组p中大于平均值的数组元素个数.例如,若输入:3 5 6 1 2 8 9 6 输出: n=4 #include int fun(float *p,int n) { float sum=0,avg,i,count=0; for(i=0;i if(*(p+i)>avg) count++; return count; } void main() {float a[8];int n,i; for(i=0;i<8;i++) scanf(\ n=fun(a,8); printf(\ NONO(); } 17
共分享92篇相关文档