填空题
以下程序从终端读入数据到数组中,统计其中正数的个数,并计算它们之和。请填空。
main()
int i,a[20],sum,count;
sum=count=0;
for(i=0;i<20;i++) scanf("%d",(
(13)
);
for(i=0;i<20; i++)
if(a[i]>0)
count++,
sum+=(
(14)
);
printf("sum=%d,count=%d\n",sum,count);
【参考答案】
&a[i]或a+i
点击查看答案
<上一题
目录
下一题>
热门
试题
填空题
以下程序运行后输出的结果是______。 main() char s[]= GFEDCBA ; int p=6; while(s[p]!=’D’) priritf( %c , p); p=p-1;
点击查看答案
填空题
以下程序的功能是将字符串s中的数字字符放入d数组中,最后输出d中的字符串。例如,输入字符串:abc123edf456gh,执行程序后输出:123456。请填空。 #include <stdio.h> #include <ctype.h> main() char s[80],d[80]; int i,j; gets(s); for(i=j=0;s[i]!=’ 0’;i++) if(______) d[j]=s[i];j++; d[j]=’ 0’; puts (d);
点击查看答案
相关试题
a[i]或*(a+i)
以下sstrcpy()函数实现字符串复制,即将t...