3.looping(iteration statements)

guptahardik05 2,127 views 10 slides May 31, 2014
Slide 1
Slide 1 of 10
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10

About This Presentation

No description available for this slideshow.


Slide Content

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
Tags