更多"[单选题]#include 'stdio.h'
void main("的相关试题:
[单选题]下面程序是计算n 个数的平均值, 请填空( )
#include void main( )
{ int i,n;
Float x,avg=0.0;
Scanf("%d",&n);
For(i=0;i{ scanf("%f",&x);
Avg=avg+______; }
Avg=________;
Printf("avg=%f\n",avg); }
A. i avg/i
B. x avg/n
C. x avg/x
D. i avg/n
[单选题]若执行下面的程序从键盘上输入9,则输出结果是( )
#include void main( ) {
Int n;
Scanf("%d",&n);
If (n++<10) printf("%d\n",n);
Else printf("%d\n",n--);
}
A.11
B. 10
C. 9
D. 8
[单选题]有以下程序
#include "stdio.h"
void main()
{ char s[12]= "a book";
printf("%.4s",s);
}
执行后的输出结果是( )。
A.a book!
B.a book![四个空格]
C.a bo
D.格式描述错误,输出不确定
[单选题]有以下程序
#include “stdio.h”
void main()
{ int x, y, z;
x=y=1;
z=x++,y++,++y;
printf("%d,%d,%d\n",x,y,z);
}
程序运行后的输出结果是( )。
A.1,2,3
B.1,3,2
C.2,3,1
D.3,1,2
[单选题]#include
void main()
{
char str[]="\"stop!\",he said";
printf(str);
}
程序的运行结果是 ( )。
A.stop!
B. "stop!"
C. "stop",he said
D. he said*/
[单选题]有以下程序
#include "stdio.h"
void main()
{ int x=0x02ff,y=0x0ff00;
printf("%d\n",(x&y)>>4|0x005f);
}
执行后的输出结果是( )。
A.127
B.255
C.128
D.1
[单选题]有以下程序
#include "stdio.h"
void main()
{ union
{ int i[2];
long k;
char c[4];
}r,*s=&r;
s->i[0]=0x39;
s->i[1]=0x38;
printf("%c\n",s->c[0]);
}
执行后的输出结果是( )。
A.39
B.9
C.38
D.8
[单选题]有以下程序
#include "stdio.h"
void main()
{ int c;
while((c=getchar())!='\n')
switch(c -'2')
{ case 0:
case 1: putchar(c+4);
case 2: putchar(c+4);break;
case 3: putchar(c+3);
default: putchar(c+2);break;
}
printf("\n");
}
通过键盘输入446755,执行后的输出结果是( )。
A.888988
B.668966
C.88898787
D.66898787
[单选题]有以下程序
#include "stdio.h"
void main()
{ int a=1;
char c='a';
float f=2.0;
printf("%d\n",(!(a==0),f!=0&&c=='A'));
}
执行后的输出结果是( )。
A.3
B.2
C.1
D.0
[单选题]有以下程序
#include
void main()
{ int s;
scanf("%d",&s);
while(s>0)
{ switch(s)
{ case 1:printf("%d",s+5);
case 2:printf("%d",s+4); break;
case 3:printf("%d",s+3);
default:printf("%d",s+1);break;
}
scanf("%d",&s);
}
}
运行时,若输入1 2 3 4 5 0<回车>,则输出结果是( )。
A.6566456
B.66656
C.66666
D.6666656
[单选题]#include "stdio.h"
void main()
{
int a=2,i=0,tn=0,sn=0;
while(i<3)
{
tn=tn+a;
sn=sn+tn;
a=a*10;
i++;
}
printf("%d",sn);
}
程序的运行结果是( )。
A.2 4 8
B.246
C.2
4
6
D.234
[单选题]下面程序的输出结果是()。
#include
#include
main()
{ char *p1="abc",*p2="ABC",str[50]= "xyz";
strcpy(str+2,strcat(p1,p2));
printf("%s\n",str);}
A.xyzabcABC
B.zabcABC
C.xyabcABC
D.yzabcABC