Consider the looping statement int i for i 0 i 10 i i 2

Consider the looping statement
int i;
for( i = 0; i < 10; i = i * 2)
{
….;
}
Assuming the body of the loop does not break the loop or change i, how many times would the body of the loop be executed?
a. 0
b. 3
c. 7
d. 10
e.

Solution

The loop will continue upto infinity because every time I becomes zero as I = I*2 . So this will continue upto infinity

Consider the looping statement int i; for( i = 0; i < 10; i = i * 2) { ….; } Assuming the body of the loop does not break the loop or change i, how many time

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site