printf(\
if((out=fopen(\ fprintf(out,\ fclose(out); }
void main() {
/*考生在此设计程序*/ int i;
double t1=1,t2=1; double s=0;
for(i=1;i<=10;i++) t1=t1*i;
for(i=3;i<=19;i+=2) t2=t2*i; s=t1/t2; PRINT(s); }
综合应用题2
题目:
已知整型数组a存储了50个数,t存储了9个数。查找a数组中在t数组中有因子的元素并求和输出。 例如:31236(t中有因子57)、2244(t中有因子68)。
输出结果的形式为: s=12345678 参考程序:
#include
FILE *out;
printf(\
if((out=fopen(\ fprintf(out,\ fclose(out); }
void main() { int
a[50]={4842,52343,723,4539,31236,9348,84,347,3233,2244,59232,333,423,957,74542,3453,82,3346,153532,2342,324,7432,8345, 73428,813,56323,3748,1277,388,913,47823,7634,823,1923,293,8432,734,634,1832,725,878,763,342,652,834,7734,873,782,64,823}; int t[9]={13,24,35,46,57,68,79,80,92}; /*考生在此设计程序*/ int i,j; long sum=0; for(i=0;i<50;i++) for(j=0;j<9;j++) if(a[i]%t[j]==0) { printf(\ sum=sum+a[i]; break;
}
}
PRINT(sum);