题目内容
如图所示,程序框图(算法流程图)的输出值
_______.


8
试题分析:分析程序中各变量、各语句的作用,再根据流程图所示的顺序,可知:该程序的作用是判断x的奇偶性,并执行对应的操作,最后不满足循环条件时,退出循环,输出X,我们可以模拟程序的运行过程,分析程序运行中各变量的值的变化情况,不难得到答案.
程序运行如下:
循环前:x=1,
第一次循环:x=2,
第二次循环:x=4,
第三次循环:x=5,
第四次循环:x=6,
第五次循环:x=8,(不满足继续循环的条件退出循环)
最后输出8.
故答案为B。
点评:这类问题,通常由开始一步一步运行,根据判断条件,要么几步后就会输出结果,要么就会出现规律,如周期性,等差或等比数列型.

练习册系列答案
相关题目