SlideShare a Scribd company logo
1 of 10
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 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
Iteration Statements
while loop
while loop
Syntax:
initialization;
while (test_condition) {
...block of code...
increment/decrement;
}
loop bodycondition
True
False
exit from loop
instructions
Iteration Statements
do-while loop
do – 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 loopcondition
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:
o continue
o break
o goto
o return

More Related Content

What's hot

Jumping statements
Jumping statementsJumping statements
Jumping statements
Suneel Dogra
 
Data Type Conversion in C++
Data Type Conversion in C++Data Type Conversion in C++
Data Type Conversion in C++
Danial Mirza
 
instruction cycle ppt
instruction cycle pptinstruction cycle ppt
instruction cycle ppt
sheetal singh
 

What's hot (20)

Functions in c language
Functions in c language Functions in c language
Functions in c language
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator Overloading
 
FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT
 
Operators and expressions in c language
Operators and expressions in c languageOperators and expressions in c language
Operators and expressions in c language
 
Jumping statements
Jumping statementsJumping statements
Jumping statements
 
If statements in c programming
If statements in c programmingIf statements in c programming
If statements in c programming
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++
 
C tokens
C tokensC tokens
C tokens
 
Structure of a C program
Structure of a C programStructure of a C program
Structure of a C program
 
Switch case in C++
Switch case in C++Switch case in C++
Switch case in C++
 
Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++
 
Comments in C Programming
Comments in C ProgrammingComments in C Programming
Comments in C Programming
 
Loops Basics
Loops BasicsLoops Basics
Loops Basics
 
Break and continue in C
Break and continue in C Break and continue in C
Break and continue in C
 
Looping in C
Looping in CLooping in C
Looping in C
 
Switch Case in C Programming
Switch Case in C ProgrammingSwitch Case in C Programming
Switch Case in C Programming
 
Data Type Conversion in C++
Data Type Conversion in C++Data Type Conversion in C++
Data Type Conversion in C++
 
Loops in c programming
Loops in c programmingLoops in c programming
Loops in c programming
 
instruction cycle ppt
instruction cycle pptinstruction cycle ppt
instruction cycle ppt
 
Loops c++
Loops c++Loops c++
Loops c++
 

Viewers also liked (8)

4.arrays
4.arrays4.arrays
4.arrays
 
5.functions
5.functions5.functions
5.functions
 
1.getting started with c
1.getting started with c1.getting started with c
1.getting started with c
 
2.decision making
2.decision making2.decision making
2.decision making
 
8.derived data types
8.derived data types8.derived data types
8.derived data types
 
6.operators
6.operators6.operators
6.operators
 
7.pointers
7.pointers7.pointers
7.pointers
 
Programming & Data Structure Lecture Notes
Programming & Data Structure Lecture NotesProgramming & Data Structure Lecture Notes
Programming & Data Structure Lecture Notes
 

Similar to 3.looping(iteration statements)

While loop,Do While loop ,for loop
While loop,Do While loop ,for loop While loop,Do While loop ,for loop
While loop,Do While loop ,for loop
MuhammadWaseem305
 

Similar to 3.looping(iteration statements) (20)

Loops in c++
Loops in c++Loops in c++
Loops in c++
 
Java Repetiotion Statements
Java Repetiotion StatementsJava Repetiotion Statements
Java Repetiotion Statements
 
Loops In C++
Loops In C++Loops In C++
Loops In C++
 
Loop
LoopLoop
Loop
 
loops and iteration.docx
loops and iteration.docxloops and iteration.docx
loops and iteration.docx
 
What is loops? What is For loop?
What is loops? What is For loop?What is loops? What is For loop?
What is loops? What is For loop?
 
cpu.pdf
cpu.pdfcpu.pdf
cpu.pdf
 
C language 2
C language 2C language 2
C language 2
 
Flow of control C ++ By TANUJ
Flow of control C ++ By TANUJFlow of control C ++ By TANUJ
Flow of control C ++ By TANUJ
 
C Programming - Decision making, Looping
C  Programming - Decision making, LoopingC  Programming - Decision making, Looping
C Programming - Decision making, Looping
 
Decision making and loop in C#
Decision making and loop in C#Decision making and loop in C#
Decision making and loop in C#
 
Programming Fundamentals in C++ structures
Programming Fundamentals in  C++ structuresProgramming Fundamentals in  C++ structures
Programming Fundamentals in C++ structures
 
Loop structures
Loop structuresLoop structures
Loop structures
 
itretion.docx
itretion.docxitretion.docx
itretion.docx
 
M C6java6
M C6java6M C6java6
M C6java6
 
Deeksha gopaliya
Deeksha gopaliyaDeeksha gopaliya
Deeksha gopaliya
 
While loop,Do While loop ,for loop
While loop,Do While loop ,for loop While loop,Do While loop ,for loop
While loop,Do While loop ,for loop
 
whileloop-161225171903.pdf
whileloop-161225171903.pdfwhileloop-161225171903.pdf
whileloop-161225171903.pdf
 
Loops in C.pptx
Loops in C.pptxLoops in C.pptx
Loops in C.pptx
 
Loops and iteration.docx
Loops and iteration.docxLoops and iteration.docx
Loops and iteration.docx
 

3.looping(iteration statements)