Conditional looping

While (Conditional Statement)

{ Statement; Statement;…}

(Execute the statements as long as the conditional statement is true)

Example:

X=0; 
while(X<=10) {
cout << X << endl;
X++;
}

(X starts with the value of 0. While X is less than or equal to 10, print the value of X, and then add 1 to the value of X.)


Feedback