题目内容

设有如下程序:main(){float x=2.0,y;if(x<0.0)y=0.0;else if(x<10.0)y=1.0/x;elsey=1.0;printf("%f\n",y);}该程序的输出结果是( )

A. 0.000000
B. 0.250000
C. 0.500000
D. 1.000000

查看答案
更多问题

若运行时给变量x输入12,则以下程序的运行结果是( )。main(){int x,y;scanf("%d",&x);y=x>12?x+10:x-12;printf("%d\n",y);}

A. 12
B. 22
C. 0
D. 1

写出下列程序的输出结果( )main(){int x=11,y=1;if(x%2==1)x+=5;elsex-=3;y+=5;printf("%d %d",x,y);}

A. 16 6
B. 11 1
C. 16 1
D. 8 6

从键盘上输入1时,程序运行结果是?#include "stdio.h"void main(){int k,sum=0;scanf("%d",&k);do{sum= sum+k;k++;} while(k<= 10);printf("sum is %d",sum);}

A. 0
B. 1
C. 11
D. 55

从键盘上输入11时,程序运行结果是?#include "stdio.h"void main(){intk,sum=0;scanf("%d",&k);do{sum=sum+k;k++;} while(k<= 10);printf("sum is %d",sum);}

A. 0
B. 1
C. 11
D. 55

答案查题题库