填空题

下列程序的运行结果是 【17】 。
#include <stdio.h>
#define M 100
void fun(int m,int *a,int *n)
int i,j=0;
for(i=1;i<=m; i++)
if(i%7==0||i%11==0) a[j++]=i;
*n=j;
main()
int aa[M],n,k;
fun(10,aa,&n);
for(k=0;k<n;k++)
if((k+1)%20==0) printf("\n");
else printf("%4d",aa[k]);
printf("\n");

【参考答案】

G
<上一题 目录 下一题>
热门 试题

填空题
函数fun的功能是:根据以下公式求p的值,结果由函数值返回。m与n为两个正数,且要求m>n。 例如:m=12,n=8时,运行结果应该是495.000000。请在题目的空白处填写适当的程序语句,将该程序补充完整。 #include <stdio.h> float fun(int m,int n) int i; double p=1.0; for(i=1;i<=m;i++) 【15】 ; for(i=1;i<=n;i++) 【16】 ; for(i=1;i<=m-n;i++) p=p i; return p; main() printf( p=%f n ,fun(12,8));
填空题
函数void fun(float *sn,int n)的功能是:根据以下公式计算s,计算结果通过形参指针 sn传回;n通过形参传入,n的值大于或等于0。请填空。 void fun(float *sn,int n) float s=0.0,w,f=-1.0; int i; for(i=0;i<=n;i++) f= 【13】 * f; w=f (2*i+1); s+=w; 【14】 =s;
相关试题
  • 设有如下宏定义: #define MYSW AP(z...
  • 下面的程序把从终端读入的文本(用@作为文...
  • 下列程序的功能是:求出ss所指字符串中指定...