SlideShare uma empresa Scribd logo
1 de 10
TYPES OF LOOPS IN C LANGUAGE
By
Sneha jadhav
 Loops statement are used to repeat the execution of
Statement or blocks.
Types of loops
1. While loop
2. Do-While loop
3. For loop
Introduction
Basic execution of loops
A loop statement allows us to
execute a statement or group of
statements multiple times
Onces the condition becomes
false the loop terminates.
 Syntax:
while(condition)
{
//Statements
}
While loop
Here, statement(s) may be a single statement or a
block of statements.
1. First Condition is evaluated.
2. If the condition is true then statement part is
executed then again it checks the condition.
3. If the condition is false then out of the while loop.
Print 1 to 5.
#include <stdio.h>
void main ()
{
int a = 1;
while( a < 6 )
{
printf("%dn", a);
a++;
}
}
While loop program
a<6 output a++
1<6 1 2
2<6 2 3
3<6 3 4
4<6 4 5
5<6 5 6
6<6==false - -
 Syntax:
do
{
//Statements
}
while(condition);
Do-while
A do...while loop is similar to a while loop,
except the fact that it is guaranteed to execute at
least one time.
1. First statement part is executed and then the
condition part is evaluated.
2. If the condition is true then again statement
part executed and then again to the condition
part.
3. If the condition is false then out of do-while
loop.
Print 0 to 6
#include <stdio.h>
void main ()
{
int a = 0;
do {
printf("%dn", a);
a + +;
}
while( a < 6 );
}
Do-while program
output a++ A<6
0 1 1<6
1 2 2<6
2 3 3<6
3 4 4<6
4 5 5<6
5 6 6<6==false
 Syntax: for ( initialization; condition; increment /decrement)
{
//statement(s);
}
1. First go for initialization.
2. Second Condition
- If the condition is true then statement part is executed and then iteration
portion.
- If the condition is false then out of the for-loop.
3 Third Iteration
-After iteration portion control goes back to condition.
For loop
Print 1 to 5
#include <stdio.h>
void main ()
{
For(int i=1; i<6; i++)
{
printf("%dn", i);
}
}
For loop program
i<6 output i++
i<6 1 2
2<6 2 3
3<6 3 4
4<6 4 5
5<6 5 6
6<6==false - -
Types of loops in c language

Mais conteúdo relacionado

Mais procurados (20)

The Loops
The LoopsThe Loops
The Loops
 
Loops in c++ programming language
Loops in c++ programming language Loops in c++ programming language
Loops in c++ programming language
 
Conditional Statement in C Language
Conditional Statement in C LanguageConditional Statement in C Language
Conditional Statement in C Language
 
Switch statement, break statement, go to statement
Switch statement, break statement, go to statementSwitch statement, break statement, go to statement
Switch statement, break statement, go to statement
 
C if else
C if elseC if else
C if else
 
Control Flow Statements
Control Flow Statements Control Flow Statements
Control Flow Statements
 
Loops in c
Loops in cLoops in c
Loops in c
 
Control statements in c
Control statements in cControl statements in c
Control statements in c
 
Conditional statement in c
Conditional statement in cConditional statement in c
Conditional statement in c
 
Loops in c programming
Loops in c programmingLoops in c programming
Loops in c programming
 
Loops and conditional statements
Loops and conditional statementsLoops and conditional statements
Loops and conditional statements
 
Control structures in java
Control structures in javaControl structures in java
Control structures in java
 
Looping statements in C
Looping statements in CLooping statements in C
Looping statements in C
 
friend function(c++)
friend function(c++)friend function(c++)
friend function(c++)
 
Loops in c language
Loops in c languageLoops in c language
Loops in c language
 
Looping statements in Java
Looping statements in JavaLooping statements in Java
Looping statements in Java
 
Type casting in c programming
Type casting in c programmingType casting in c programming
Type casting in c programming
 
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
 
Typecasting in c
Typecasting in cTypecasting in c
Typecasting in c
 

Destaque

Loops in C Programming
Loops in C ProgrammingLoops in C Programming
Loops in C ProgrammingHimanshu Negi
 
Basics of C programming
Basics of C programmingBasics of C programming
Basics of C programmingavikdhupar
 
How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheLeslie Samuel
 
C Prog. - Decision & Loop Controls
C Prog. - Decision & Loop ControlsC Prog. - Decision & Loop Controls
C Prog. - Decision & Loop Controlsvinay arora
 
Health hazards of mobile phones
Health hazards of mobile phonesHealth hazards of mobile phones
Health hazards of mobile phonesArun Raj
 
Difference between combinational and
Difference between combinational andDifference between combinational and
Difference between combinational andDamodar Panigrahy
 
Loops Basics
Loops BasicsLoops Basics
Loops BasicsMushiii
 
mechanics of solids
mechanics of solidsmechanics of solids
mechanics of solidsjayrishabh
 
Array in c language
Array in c languageArray in c language
Array in c languagehome
 
C Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointC Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointJavaTpoint.Com
 
digital india presentation
digital india presentationdigital india presentation
digital india presentationHARSH GOSWAMI
 
Biodiversity and its Conservation
Biodiversity and its ConservationBiodiversity and its Conservation
Biodiversity and its ConservationAkhil Kollipara
 
C decision making and looping.
C decision making and looping.C decision making and looping.
C decision making and looping.Haard Shah
 
Digital India PPT
Digital India PPTDigital India PPT
Digital India PPTAvani Bedi
 

Destaque (20)

Loops in C Programming
Loops in C ProgrammingLoops in C Programming
Loops in C Programming
 
Basics of C programming
Basics of C programmingBasics of C programming
Basics of C programming
 
How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your Niche
 
C Prog. - Decision & Loop Controls
C Prog. - Decision & Loop ControlsC Prog. - Decision & Loop Controls
C Prog. - Decision & Loop Controls
 
Health hazards of mobile phones
Health hazards of mobile phonesHealth hazards of mobile phones
Health hazards of mobile phones
 
All flipflop
All flipflopAll flipflop
All flipflop
 
Difference between combinational and
Difference between combinational andDifference between combinational and
Difference between combinational and
 
Loops Basics
Loops BasicsLoops Basics
Loops Basics
 
mechanics of solids
mechanics of solidsmechanics of solids
mechanics of solids
 
Array in C
Array in CArray in C
Array in C
 
Arrays
ArraysArrays
Arrays
 
Array in c language
Array in c languageArray in c language
Array in c language
 
C ppt
C pptC ppt
C ppt
 
C Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointC Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpoint
 
Water pollution power point
Water pollution power pointWater pollution power point
Water pollution power point
 
Digital india ppt
Digital india pptDigital india ppt
Digital india ppt
 
digital india presentation
digital india presentationdigital india presentation
digital india presentation
 
Biodiversity and its Conservation
Biodiversity and its ConservationBiodiversity and its Conservation
Biodiversity and its Conservation
 
C decision making and looping.
C decision making and looping.C decision making and looping.
C decision making and looping.
 
Digital India PPT
Digital India PPTDigital India PPT
Digital India PPT
 

Semelhante a Types of loops in c language

2. Control structures with for while and do while.ppt
2. Control structures with for while and do while.ppt2. Control structures with for while and do while.ppt
2. Control structures with for while and do while.pptManojKhadilkar1
 
rtsoft solutions.ppt(1).pptx
rtsoft solutions.ppt(1).pptxrtsoft solutions.ppt(1).pptx
rtsoft solutions.ppt(1).pptxpanderohit000
 
C Programming - Decision making, Looping
C  Programming - Decision making, LoopingC  Programming - Decision making, Looping
C Programming - Decision making, LoopingMURALIDHAR R
 
Programming Fundamentals in C++ structures
Programming Fundamentals in  C++ structuresProgramming Fundamentals in  C++ structures
Programming Fundamentals in C++ structuresayshasafdarwaada
 
Loop and while Loop
Loop and while LoopLoop and while Loop
Loop and while LoopJayBhavsar68
 
Control Statement IN C.pptx
Control Statement IN C.pptxControl Statement IN C.pptx
Control Statement IN C.pptxsujatha629799
 
Control Structures in C
Control Structures in CControl Structures in C
Control Structures in Csana shaikh
 
Loops in c language
Loops in c languageLoops in c language
Loops in c languageTanmay Modi
 
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
 
Dti2143 chap 4 control structures aka_selection
Dti2143 chap 4 control structures aka_selectionDti2143 chap 4 control structures aka_selection
Dti2143 chap 4 control structures aka_selectionalish sha
 

Semelhante a Types of loops in c language (20)

2. Control structures with for while and do while.ppt
2. Control structures with for while and do while.ppt2. Control structures with for while and do while.ppt
2. Control structures with for while and do while.ppt
 
itretion.docx
itretion.docxitretion.docx
itretion.docx
 
rtsoft solutions.ppt(1).pptx
rtsoft solutions.ppt(1).pptxrtsoft solutions.ppt(1).pptx
rtsoft solutions.ppt(1).pptx
 
C Programming - Decision making, Looping
C  Programming - Decision making, LoopingC  Programming - Decision making, Looping
C Programming - Decision making, Looping
 
Controls & Loops in C
Controls & Loops in C Controls & Loops in C
Controls & Loops in C
 
Programming Fundamentals in C++ structures
Programming Fundamentals in  C++ structuresProgramming Fundamentals in  C++ structures
Programming Fundamentals in C++ structures
 
Decision Making and Looping
Decision Making and LoopingDecision Making and Looping
Decision Making and Looping
 
Loop and while Loop
Loop and while LoopLoop and while Loop
Loop and while Loop
 
Ch3 repetition
Ch3 repetitionCh3 repetition
Ch3 repetition
 
175035-cse LAB-04
175035-cse LAB-04 175035-cse LAB-04
175035-cse LAB-04
 
Loops and iteration.docx
Loops and iteration.docxLoops and iteration.docx
Loops and iteration.docx
 
UNIT 2 PPT.pdf
UNIT 2 PPT.pdfUNIT 2 PPT.pdf
UNIT 2 PPT.pdf
 
Control Statement IN C.pptx
Control Statement IN C.pptxControl Statement IN C.pptx
Control Statement IN C.pptx
 
[ITP - Lecture 11] Loops in C/C++
[ITP - Lecture 11] Loops in C/C++[ITP - Lecture 11] Loops in C/C++
[ITP - Lecture 11] Loops in C/C++
 
Control Structures in C
Control Structures in CControl Structures in C
Control Structures in C
 
Loops in c language
Loops in c languageLoops in c language
Loops in c language
 
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?
 
C Programming Unit-2
C Programming Unit-2C Programming Unit-2
C Programming Unit-2
 
M C6java6
M C6java6M C6java6
M C6java6
 
Dti2143 chap 4 control structures aka_selection
Dti2143 chap 4 control structures aka_selectionDti2143 chap 4 control structures aka_selection
Dti2143 chap 4 control structures aka_selection
 

Último

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdfssuserdda66b
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 

Último (20)

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 

Types of loops in c language

  • 1. TYPES OF LOOPS IN C LANGUAGE By Sneha jadhav
  • 2.  Loops statement are used to repeat the execution of Statement or blocks. Types of loops 1. While loop 2. Do-While loop 3. For loop Introduction
  • 3. Basic execution of loops A loop statement allows us to execute a statement or group of statements multiple times Onces the condition becomes false the loop terminates.
  • 4.  Syntax: while(condition) { //Statements } While loop Here, statement(s) may be a single statement or a block of statements. 1. First Condition is evaluated. 2. If the condition is true then statement part is executed then again it checks the condition. 3. If the condition is false then out of the while loop.
  • 5. Print 1 to 5. #include <stdio.h> void main () { int a = 1; while( a < 6 ) { printf("%dn", a); a++; } } While loop program a<6 output a++ 1<6 1 2 2<6 2 3 3<6 3 4 4<6 4 5 5<6 5 6 6<6==false - -
  • 6.  Syntax: do { //Statements } while(condition); Do-while A do...while loop is similar to a while loop, except the fact that it is guaranteed to execute at least one time. 1. First statement part is executed and then the condition part is evaluated. 2. If the condition is true then again statement part executed and then again to the condition part. 3. If the condition is false then out of do-while loop.
  • 7. Print 0 to 6 #include <stdio.h> void main () { int a = 0; do { printf("%dn", a); a + +; } while( a < 6 ); } Do-while program output a++ A<6 0 1 1<6 1 2 2<6 2 3 3<6 3 4 4<6 4 5 5<6 5 6 6<6==false
  • 8.  Syntax: for ( initialization; condition; increment /decrement) { //statement(s); } 1. First go for initialization. 2. Second Condition - If the condition is true then statement part is executed and then iteration portion. - If the condition is false then out of the for-loop. 3 Third Iteration -After iteration portion control goes back to condition. For loop
  • 9. Print 1 to 5 #include <stdio.h> void main () { For(int i=1; i<6; i++) { printf("%dn", i); } } For loop program i<6 output i++ i<6 1 2 2<6 2 3 3<6 3 4 4<6 4 5 5<6 5 6 6<6==false - -