1、1.求 A 数组中奇数的和。#include #include void main() int arr10=11,4,2,7,3,12,5,34,5,9,i;int s=0;/*found*/for ( i=0; i#include #include void main() int a12=2,3,5,7,8,9,10,11,12,13,15,17,i,j,k,s;/*found*/s=0;for ( i=0; ik )/*found*/s=s+ai;printf(“Sum is: %dn“,s);3. 求数组中 所有奇数的平均值#include #include double average
2、( int arr , int n ) int k=0,i; double s;s = 0;for ( i=0 ;i#include #include #include void main() int score,t;printf(“Please enter a score:“);doscanf(“%d“,while(score100);t=score/10;/*found*/switch(t) case 10:case 9:printf(“优秀!n“);break;case 8:printf(“良好!n“);break;case 7:printf(“中等!n“);break;case 6:p
3、rintf(“及格!n“);break;/*found*/default:printf(“不及格!n“);7在 C 程序中打印出 1 到 1000 中满足其个位数的立方等于其本身的所有整数#include main()int i,g;for(i=1;i#include double average( int arr , int n ) int k=0,i; double s;s = 0;for ( i=0 ;i#define N 3int fun(int aNN)int min;/*begin*/int i,j;min=a00;for(i=0;i#include sum ( int arr ,
4、int n ) int i,s;s = 0;for ( i=0; i=x)s =s+t;n=n+2.0;k=-k;t=k/n;return s ; /程序编写部分/*end*/void main() double x,sum;printf(“Enter x:n“);scanf(“%lf“,sum=fun(x);printf(“sum=%.4fn“,sum);NONO( );NONO( ) FILE *fr,*fw;int i;double x;fr=fopen(“D:exam04500129PROGIN.DAT“,“r“);fw=fopen(“D:exam04500129PROGOUT.DAT“,“w“);for(i=1;imain()int i,g;for(i=1;i1000;i+)/*found*/g=i%10;/*found*/