首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #include using namespace std; int main() { int f,f1=1,f2=1; for(int i=0;i
有如下程序: #include using namespace std; int main() { int f,f1=1,f2=1; for(int i=0;i
admin
2020-07-23
44
问题
有如下程序:
#include
using namespace std;
int main() {
int f,f1=1,f2=1;
for(int i=0;i<=5;i+=2) {
f=f1*2+f2;
f1=f2; f2=f;
}
cout<
return 0;
}
运行时的输出结果是
选项
A、5
B、21
C、85
D、11
答案
B
解析
本题考查for循环,当i为0时,f1变为1,f2变为3;当i为2时,f1变为3,f2变为5;当i为4时,f1变为5,f2变为11,即f为11,所以答案为D。
转载请注明原文地址:https://kaotiyun.com/show/bQyp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
下列语句中,错误的是
下列叙述中,错误的是
将E-R图转换为关系模式时,实体和联系都可以表示为( )。
有如下类定义:classSample{public:Sample(intx):ref(x){}//1private:Sample(){ref=0;}//2staticintval
下列运算符中,不能作为成员函数重载的是
在公有继承的情况下,在派生类中能够访问的基类成员包括
若要对Data类中重载的加法运算符成员函数进行声明,下列选项中正确的是()。
有三个关系R、S和T如下:则由关系R和S得到关系T的操作是( )。
在软件开发中,需求分析阶段可以使用的工具是()。
下列数据结构中,能够按照“先进后出”原则存取数据的是()。
随机试题
Whatisinthedrugthatmakesyousickordead?【C1】______,cocaineisharmful,butwhatmakesitharmful?Ican’ttellyou
肝肾阴虚闭经的主要证候不包括
《票据法》中所指的票据包括()。
美术教学评价的种类有哪些?
某Web网站向CA申请了数字证书。用户登录该网站时,通过验证(7),可确认该数字证书的有效性,从而(8)。
「 そうで、安心しました。」 「おかげさまで、病気はすっかりよくなりました。」
SharksPerformaServiceforEarth’sWatersItishardtogetpeopletothinkofsharksasanythingbutadeadlyenemy.They
Thatwasaman-madedisasterthatclearly______ifthefederalgovernment,theFederalEmergencyManagementAgency,hadquicklym
Accordingtotheconversation,whichofthefollowingstatementsisINCORRECT?
Thedebateaboutproblemdrinkingandhowtostopitnowadayscentresmostontheworking-classyoung.Theyare【M1】______highly
最新回复
(
0
)