Control Statements do while loop: This statements is just like a while loop, only difference is that condition is checked after the execution of the statements. In the do.. while loop first the statements is executed in the do block, the the conditions are checked from the while block. Untill the condition turns false, the statements or block of statements from the do block executes. Syntax of do.. while loop: do { Single statement or Block of statements; } while(Condition); Control Statements for loop: for loop is one of the powerful statements which is similiar to while loop. In the for loop contains 3 conditions, Initial value, conditions and increment or decrement. until the conditions satisfies, the block of statements will be executed. for statements are often used to process lists such a range of numbers: Basic syntax of for loop is as follows: for( initial value; Condition; increment/dec...
Syntax for Nested if Statements: if (expression) { Block of statements; } else if(expression) { else Block of statements; } { } Block of statements; Loops: Sometimes, we need to print a series of numbers or some block of contents for certain number of times, The major difference between branching and loop statement that the branching statements will execute the statements only one time, but the loop statement will execute mentioned number of times. We start with while loops and then go on to show this can be converted to do-while and for loops. while loop The most basic loop in C is the while loop. A while statement is like a repeating if statement. Like an If statement, if the test condition is true: the statements get executed. The difference is once the statement have been executed, the condition in the while parenthesis is checked again. If it is still true the statements get executed agai...