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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!