1.

What is a Loop? What are different types of loops in C++?

Answer»

In C++ LOOP is USED to perform specific repetitive tasks until a condition is satisfied.

TYPES OF LOOPS

1.FOR LOOP
for ( variable initialization; condition; variable update ) {
   // CODE to execute while the condition is TRUE
}

2. WHILE LOOP
while ( condition )
{
    // Code to execute while the situation is true
};

3. DO-WHILE LOOP
do {
} while ( condition );



Discussion

No Comment Found