2、、i>nD、i<=n(3)A、item=flag/deB、item=1/deC、item=flag*1.0/deD、item=1.0/de(4)A、flag=0B、flag=1C、flag=-flagD、flag=-1试题2、验证哥德巴赫猜想,每行输出五个,每个>=6的偶数只需拆分成一对素数之和即可程序:#include#includeintprime(intm){inti,n;if(m==1)return0;n=sqrt(m);for(i=2;i<=n;i++)if(m%i==0)return0;⑸}voidm
3、ain(){inti,count,number;count=0;for(number=6;number<=20;number+=2){for(i=3;i<=number/2;i+=2)if(⑹){printf("%d=%d+%d",number,i,number-i);count++;if(⑺)printf("");⑻}}}供选择的答案:(1)A、;B、return1;C、return0;D、elsereturn1;(2)A、prime(i)!=0
4、
5、prime(number-i)!=0B、prime(i)!=0&&prime(number-
6、i)!=0C、prime(i)==0
7、
8、prime(number-i)==0D、prime(i)==0&&prime(number-i)==0(3)A、count%5==0B、count%5!=0;C、(count+1)%5==0D、(count+1)%5!=0(4)A、break;B、elsebreak;C、continue;D、;试题1、输入一行字符,统计并输出其中数字字符、英文字母和其它字符的个数。#includevoidcount(char*s,int*digit,int*letter,int*other){⑼while
9、(⑽){if(*s>='0'&&*s<='9')(*digit)++;elseif((*s>='a'&&*s<='z')
10、
11、(*s>='A'&&*s<='Z'))(*letter)++;else(*other)++;s++;}}voidmain(){inti=0,digit,letter,other;charch,str[80];printf("Entercharacters:");ch=getchar();while(⑾){str[i]=ch;i++;ch=getchar();}str[i]=' ';⑿;printf("Digit=%dlet
12、ter=%dother=%d",digit,letter,other);}供选择的答案:(1)A、intdigit=0,letter=0,other=0;B、int*digit=0,*letter=0,*other=0;C、digit=letter=other=0;D、*digit=*letter=*other=0;(2)A、*s++!=’ ’B、*s++!=’’C、*s!=’ ’D、*s!=’’(3)A、ch!=’ ’B、ch!=’’C、ch==’ ’D、ch==’’(4)A、count(str,&digit,&le
13、tter,&other)B、count(&str,&digit,&letter,&other)C、count(*str,digit,letter,other)D、count(*str,*digit,*letter,*other)试题1、挑选正确答案#includevoidmain(){intflag=0,i;inta[7]={8,9,7,9,8,9,7};for(i=0;i<7;i++)if(a[i]==7){flag=i;break;}printf("%d",flag);//line1flag=-1;for(i=6;i>=
14、0;i--)if(a[i]==8){break;flag=i;}printf("%d",flag);//line2flag=0;fo