Iteration Statements What you’ll learn: while loop do – while loop for loop Jump Statements
What are iteration statements? An iteration statement, or loop, is a way of repeating a statement, known as loop body, a number of times until some condition is satisfied . We have following types of iteration statements in C: w hile loop d o-while loop f or loop Set of instructions condition True False
Iteration Statements while loop
w hile loop Syntax: initialization; while ( test_condition ) { ...block of code... increment/decrement; } loop body condition True False e xit from loop instructions
Iteration Statements d o-while loop
d o – while loop Syntax: initialization; do { …block of code… increment/decrement; } while ( test_condition ); condition True Exit from loop Loop body False
Iteration Statements for loop
for loop Exit from loop condition False True Loop body initialization Syntax: for ( initialization; test_condition ; update_expression ) { … block of code… } Update Expression
Jump Statements What are jumping statements ?
What are jumping statements? Jump statements can be used to modify the behavior of conditional and iterative statements. Some jump statements provided by C are: continue break goto return