The correct answer is A. while.
In a while loop, first we check the condition. If the condition is true, then it executes the true statement. The loop will continue to execute as long as the condition is true.
A do-while loop is similar to a while loop, except that the condition is checked at the end of the loop instead of the beginning. This means that the true statement will always be executed at least once, even if the condition is false.
An if-else statement is used to execute different statements depending on whether a condition is true or false.
A nested loop is a loop that is inside another loop. Nested loops can be used to iterate over multiple data structures or to perform complex calculations.
Here is an example of a while loop:
int i = 0;
while (i < 10) {
cout << i << endl;
i++;
}
This loop will print the numbers from 0 to 9.
Here is an example of a do-while loop:
int i = 0;
do {
cout << i << endl;
i++;
} while (i < 10);
This loop will also print the numbers from 0 to 9, but it will always print the first number, even if the condition is false.
Here is an example of an if-else statement:
int x = 5;
if (x == 5) {
cout << "x is 5" << endl;
} else {
cout << "x is not 5" << endl;
}
This statement will print “x is 5”.
Here is an example of a nested loop:
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
cout << i << " " << j << endl;
}
}
This loop will print all of the numbers from 0 to 90.