How many times will the body of the following loop be execut
来源:学生作业帮 编辑:作业帮 分类:英语作业 时间:2024/05/28 12:39:46
How many times will the body of the following loop be executed?
int sum = 0;
int n;
for (n = 9; n > 0; n = n / 2)
sum = sum + n;
(a) once
(b) twice
(c) four times
(d) three times
为什么答案是三次呢?不是四次么?n=9,4,2,1各一次?
int sum = 0;
int n;
for (n = 9; n > 0; n = n / 2)
sum = sum + n;
(a) once
(b) twice
(c) four times
(d) three times
为什么答案是三次呢?不是四次么?n=9,4,2,1各一次?
ecause the first time n=4; second time n=2; third time n=1.
no more.
the question is how many time the body is executed,however n=9 is defined,not a result from execution.
:-)
no more.
the question is how many time the body is executed,however n=9 is defined,not a result from execution.
:-)
How many times will the body of the following loop be execut
How many times will the minute hand and the hour hand be in
how many times did the clock__?
How many countries will be participated in the Shanghai Expo
How many days will the show be on
The following materials will be removed
"How many times do the long and short hands of a clock pile
How many times per days do the hour and minutes hards of a c
In writing all of the integers from 1 to 300,how many times
how many times is their total area larger than that of the b
which of the following can be shammed?
Loop the loop中文翻译