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 (20)

Programming in c Arrays
Programming in c ArraysProgramming in c Arrays
Programming in c Arrays
 
C functions
C functionsC functions
C functions
 
While loop
While loopWhile loop
While loop
 
Java Data Types
Java Data TypesJava Data Types
Java Data Types
 
Loops in c
Loops in cLoops in c
Loops in c
 
Looping in C
Looping in CLooping in C
Looping in C
 
Control Statements in Java
Control Statements in JavaControl Statements in Java
Control Statements in Java
 
Inline function
Inline functionInline function
Inline function
 
Loops in c language
Loops in c languageLoops in c language
Loops in c language
 
Looping (Computer programming and utilization)
Looping (Computer programming and utilization)Looping (Computer programming and utilization)
Looping (Computer programming and utilization)
 
Function in C program
Function in C programFunction in C program
Function in C program
 
07. Virtual Functions
07. Virtual Functions07. Virtual Functions
07. Virtual Functions
 
Function overloading
Function overloadingFunction overloading
Function overloading
 
Control structures in java
Control structures in javaControl structures in java
Control structures in java
 
Presentation on Function in C Programming
Presentation on Function in C ProgrammingPresentation on Function in C Programming
Presentation on Function in C Programming
 
10. switch case
10. switch case10. switch case
10. switch case
 
Conditional statement c++
Conditional statement c++Conditional statement c++
Conditional statement c++
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 
Life cycle-of-a-thread
Life cycle-of-a-threadLife cycle-of-a-thread
Life cycle-of-a-thread
 
Loops and conditional statements
Loops and conditional statementsLoops and conditional statements
Loops and conditional statements
 

Viewers also liked

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)

Java Repetiotion Statements
Java Repetiotion StatementsJava Repetiotion Statements
Java Repetiotion StatementsHuda Alameen
 
loops and iteration.docx
loops and iteration.docxloops and iteration.docx
loops and iteration.docxJavvajiVenkat
 
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?AnuragSrivastava272
 
Flow of control C ++ By TANUJ
Flow of control C ++ By TANUJFlow of control C ++ By TANUJ
Flow of control C ++ By TANUJTANUJ ⠀
 
C Programming - Decision making, Looping
C  Programming - Decision making, LoopingC  Programming - Decision making, Looping
C Programming - Decision making, LoopingMURALIDHAR R
 
Decision making and loop in C#
Decision making and loop in C#Decision making and loop in C#
Decision making and loop in C#Prasanna Kumar SM
 
Programming Fundamentals in C++ structures
Programming Fundamentals in  C++ structuresProgramming Fundamentals in  C++ structures
Programming Fundamentals in C++ structuresayshasafdarwaada
 
Loops in c programming
Loops in c programmingLoops in c programming
Loops in c programmingCHANDAN KUMAR
 
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
 
whileloop-161225171903.pdf
whileloop-161225171903.pdfwhileloop-161225171903.pdf
whileloop-161225171903.pdfBasirKhan21
 

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
 
Loops in c programming
Loops in c programmingLoops in c programming
Loops in c programming
 
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
 

3.looping(iteration statements)