C语言一维数组求和
#include"stdio.h"voidmain(){voidNONO(intsum1,doublesum2);//函数声明doublerea[10]={8.95,68...
#include "stdio.h" void main() { void NONO( int sum1,double sum2);//函数声明 double rea[10]={ 8.95,68.81,43.21,13.55,69.38,56.46,15.52,76.06,82.33,83.17 }; int sum1; double sum2; /***********begin***********/ /************end************/ printf("sum1=%d,sum2=%.2f\n",sum1,sum2); NONO(sum1,sum2); } void NONO( int sum1,double sum2) { FILE *f; f=fopen("E:\\homework\\19020211\\PROGOUT.DAT","w"); fprintf(f,"sum1=%d,sum2=%.2f\n",sum1,sum2); fclose(f); }
展开
1个回答
2013-07-22
展开全部
这很简单啊,在中间填for(int i=0;i<10;i++){sum1+=rea[i];sum2+=rea[i];}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询