Question: (2)Consider the following C++ program segment: num = 0; //Line 1 while (num
(2)Consider the following C++ program segment:
num = 0; //Line 1
while (num <= 10) //Line 2
{
cout << num << ; //Line 3
num = num + 2; //Line 4
}
i. Name the loop control variable.
ii. Update statement?
iii. What will happen if:
a. delete the statement num += 2; from the body of the loop.
b. not initialize the loop control variable num before execute the loop.
c. the two statements in Line 3 and Line 4 in the body of the loop are interchanged.
d. put ; at the end of while loop.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
