(Solved):Assume that the following code is correctly inserted into a program: int s = 0; for (i = 0; i less than 5; i++) { s = 2 * s + i; cout less thanless than s less thanless than ” “; } cout less thanle… View Answer…

 

Question

Assume that the following code is correctly inserted into a program:

int s = 0;

for (i = 0; i < 5; i++) {

s = 2 * s + i;

cout << s << ” “;

}

cout << endl;

a. What is the final value of s? (i) 11 (ii) 4 (iii) 26 (iv) none of these

b. If a semicolon is inserted after the right parenthesis in the for loop statement, what is the final

Scroll to top