3-16下列程序段的功能是计算:s=1+12+123+1234+12345,则画线处应填写____ 。#include int main(){int t=0,s=0,i;for(i=1;i<=5;i++){t=i+___;(数值在前,变量在后)s=s+t;}printf("s=%d\n",s);return 0;}
查看答案
3-17以下程序段输入:7 10,输出结果是 _____ 。#include int main(){int m,n,s=0,i;scanf("%d%d",&m,&n);for(i=m;i<=n;i++){if(i
3-18以下程序段的输出结果是i= _____ ,s=_____。#include int main( ){int i, s=0;for(i=1;i<10;i++){s+=i*i;if(s>10) break;}printf("i=%d,s=%d\n",i,s);return 0;}
3-19 以下程序段的输出结果是 n=_____,s=_____ 。# include int main( ){int i, s=0, n=0;for(i=1; i<10; i++){if(i%2==0||i%3==0) continue;n++;s+=i;}printf("n=%d,s=%d\n",n,s);return 0;}
3-20以下程序段的输出结果是 t=_____ ,s=_____。# include int main( ){int i, s=0, t=0;for(i=1; i<10; i++)switch(i<6){case 0: t+=i; break;case 1: s+=i; break;}printf("t=%d,s=%d\n", t, s);return 0;}