0
Iteration Statements
What you’ll learn:
1. while loop
2. do – while loop
3. for loop
4. Jump Statements
What are iteration statements?
 An iteration statement, or loop, is a way
of repeating a statement, known as loop
body, a...
Iteration Statements
while loop
while loop
Syntax:
initialization;
while (test_condition) {
...block of code...
increment/decrement;
}
loop bodycondition
...
Iteration Statements
do-while loop
do – while loop
Syntax:
initialization;
do {
…block of code…
increment/decrement;
} while (test_condition);
condition
True...
Iteration Statements
for loop
for loop
Exit from loopcondition
False
True
Loop body
initialization
Syntax:
for ( initialization; test_condition; update_...
Jump Statements
What are jumping statements ?
What are jumping statements?
 Jump statements can be used to modify the behavior of conditional and iterative
statements....
Upcoming SlideShare
Loading in...5
×

3.looping(iteration statements)

77

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
77
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "3.looping(iteration statements)"

  1. 1. Iteration Statements What you’ll learn: 1. while loop 2. do – while loop 3. for loop 4. Jump Statements
  2. 2. 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:  while loop  do-while loop  for loop Set of instructions condition True False
  3. 3. Iteration Statements while loop
  4. 4. while loop Syntax: initialization; while (test_condition) { ...block of code... increment/decrement; } loop bodycondition True False exit from loop instructions
  5. 5. Iteration Statements do-while loop
  6. 6. do – while loop Syntax: initialization; do { …block of code… increment/decrement; } while (test_condition); condition True Exit from loop Loop body False
  7. 7. Iteration Statements for loop
  8. 8. for loop Exit from loopcondition False True Loop body initialization Syntax: for ( initialization; test_condition; update_expression ) { …block of code… } Update Expression
  9. 9. Jump Statements What are jumping statements ?
  10. 10. 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: o continue o break o goto o return
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×