首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序: #include<stdio.h> main() {double x=2.0,y; if(x<0.0)y=0.0; else if((x<5.0)&&(!x)) y=1.0/(x
有以下程序: #include<stdio.h> main() {double x=2.0,y; if(x<0.0)y=0.0; else if((x<5.0)&&(!x)) y=1.0/(x
admin
2019-02-02
43
问题
有以下程序:
#include<stdio.h>
main()
{double x=2.0,y;
if(x<0.0)y=0.0;
else if((x<5.0)&&(!x))
y=1.0/(x+2.0);
else if(x<10.0)y=1.0/x;
else y=10.0;
printf("%f\n",y);
}
程序运行后的输出结果是( )。
选项
A、0.000000
B、0.250000
C、0.500000
D、1.000000
答案
C
解析
本题重点考查if语句,变量x和y均为double类型,由于变量x赋值为2.0,因此执行if((x<5.0)&&(!x)),即条件为0,继续执行if(x<1 0.0),条件为真,即执行y=1.0/x;。依据printf()函数输出类型,f是以小数形式输出单/双精度实数。故C选项正确。
转载请注明原文地址:https://kaotiyun.com/show/zERp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
以下程序的功能是计算:s=1+12+123+1234+12345。请填空。main(){intt=0,s=0,i;for(i=1;i<=5;i++){t=i+();s=s+t;}printf("s=%
下列程序的运行结果是()。voidfun(int*a,int*b){int*k;k=a;a=b;b=k;}main(){inta=3,b=6,*x=&a,*y=&b;
在软件开发中,下面的任务不属于设计阶段的是()。
若x和y代表整型数,以下表达式中不能正确表示数学关系|x-y|<10的是
下列关于队列的叙述中正确的是
下面程序main(){inty=9;for(;y>0;y--){if(y%3=0){printf("%d",--y);continue;
在线性表的多种存储结构中,最简单的方法是【】
假设用—个长度为50的数组(数组元素的下标从0至到49)作为栈的存储空间,栈底指针bottom指向栈底元素,栈顶揩针top指向栈顶元素,如果bottomn=49,top=30(数组下标),则栈中具有【】个元素。
下列实体类型的联系中,属于一对多联系的是()。
在E-R图中,用来表示实体联系的图形是()。【09年9月】
随机试题
A、decadeB、aggressiveC、ancestorD、bacteriaD选项D画线字母读,其他选项画线字母读[e]。
关于焦点方位特性的描述。正确的是
目前口服抗真菌作用最强的药物是
会计机构、会计人员必须审核原始凭证,这是法定职责。()
借款人的还款能力出现明显问题,依托其正常经营收入已经无法保证按时足额偿还本息的贷款属于()。
在( )的情况下,资本公积可能出现借方发生额。
简述取得时效的构成条件。
结合材料,回答问题:3月17日至18日,中共中央总书记、国家主席、中央军委主席习近平赴河南省兰考县调研指导党的群众路线教育实践活动。习近平一下飞机,就直奔兰考焦裕禄同志纪念馆。这是他时隔5年之后,第二次来到这块精神圣地。置身焦园,睹物思人。习近平
下图是一有限自动机的状态转换图,该自动机所识别语言的特点是(45),等价的正规式为(46)。
A—proofofdeathH—releasecertificateB—bodilyharmI—copyrightlawC—keywitnessJ—sumofclaimD—rightofauthorK—housearre
最新回复
(
0
)