Loops
Loops
2)For loops.
3)While loop.
>>> A while loop in C/C++ is a basic control structure that
executes a block of code continuously as long as a specified
condition is true. It enables dynamic iterations.
while (condition) {
// Code to be executed as long as the condition is true
}
4) Do-While Loop.
>> A do-while loop in C/C++ repeats a set of instructions
while a condition is true. It always executes the code at least
once, checking the condition after each iteration. Useful for
tasks needing initial execution. The syntax typically follow:-
do {
// Code to be executed
} while (condition);