SlideShare a Scribd company logo
C language Loop Control
(for , while , do while)
Copyright © 2015 · Sourav Ganguly · All Rights Reserved.
Sourav Ganguly
Please visit my Youtube channel
Step 1: go to www.google.com
Step 2: Search for “sourav ganguly c programming”.
Step 3: Click on my image bottom of the video. You will reach my
channel.
Youtube (direct link):
https://www.youtube.com/channel/UCDsQskBhM107VIYLjg8kczg
Website:
http://www.startselfstudy.blogspot.in
Copyright © 2015 · Sourav Ganguly · All Rights Reserved.
for loop of C language…..
Different types of for loop in C language…..
for loop example with real program…..
[Live Demo on YouTube channel]
while loop of C language…..
Different types of while loop in C language…..
while loop example with real program…..
[Live Demo on YouTube channel]
do while loop of C language…..
Different types of do while loop in C language…..
do while loop example with real program…..
[Live Demo on YouTube channel]
Index
Copyright © 2015 · Sourav Ganguly · All Rights Reserved.
for loop of C language…..
for ( initialization ; condition(TRUE / FALSE) ; increment / decrement )
{
Task / Job;
}
int x;
for ( x=0 ; x < 3 ; x=x+1 )
{
printf(“%d”,x);
printf(“n”);
}
printf(“Loop end”);
Output:
0
1
2
Loop end
Copyright © 2015 · Sourav Ganguly · All Rights Reserved.
6
1 2
3
4
5
for ( initialization ; condition(TRUE / FALSE) ; increment / decrement )
{
for ( init ; con(TRUE / FALSE) ; inc / dec )
{
Task / Job;
}
}
Copyright © 2015 · Sourav Ganguly · All Rights Reserved.
12
1 2
3
4
11
5
6
7
8
9
10
nested for loop of C language…..
int loop1,loop2;
for ( loop1=0 ; loop1 < 3 ; loop1=loop1+1 )
{
for ( loop2=0 ; loop2 < 3 ; loop2=loop2+1 )
{
printf(“%d”,loop2);
}
printf(“n”);
printf(“Loop2 end”);
printf(“n”);
}
printf(“Loop1 end”);
Output:
012
Loop2 end
012
Loop2 end
012
Loop2 end
Loop1 end
Copyright © 2015 · Sourav Ganguly · All Rights Reserved.
nested for loop of C language….. example
initialization ;
while (condition(TRUE / FALSE) )
{
Task / Job;
increment / decrement ;
}
int x=0;
while ( x < 3 )
{
printf(“n%d”,x);
x=x+1;
}
printf(“Loop end”);
Output:
0
1
2
Loop end
Copyright © 2015 · Sourav Ganguly · All Rights Reserved.
5
1 2
3 4
while loop of C language…..
initialization ;
while (condition(TRUE / FALSE) )
{
init ;
while (con(TRUE / FALSE))
{
Task / Job;
inc / dec ;
}
increment / decrement ;
}
Copyright © 2015 · Sourav Ganguly · All Rights Reserved.
1 2
3
4
9
5
6
7
8
10
nested while loop of C language…..
int loop1,loop2;
loop1=0 ;
while (loop1 < 3)
{
loop2=0 ;
while (loop2 < 3)
{
printf(“%d”,loop2);
loop2=loop2+1;
}
printf(“n”);
printf(“Loop2 end”);
loop1=loop1+1;
}
printf(“Loop1 end”);
Output:
012
Loop2 end
012
Loop2 end
012
Loop2 end
Loop1 end
Copyright © 2015 · Sourav Ganguly · All Rights Reserved.
nested while loop of C language….. example
initialization ;
do
{
Task / Job;
increment / decrement ;
}
while (condition(TRUE / FALSE) ) ;
int x=0;
do
{
printf(“n%d”,x);
x=x+1;
} while( x < 3 );
printf(“Loop end”);
Output:
0
1
2
Loop end
Copyright © 2015 · Sourav Ganguly · All Rights Reserved.
6
1
2
4
5
do while loop of C language…..
3
initialization ;
do
{
init ;
do
{
Task / Job;
inc / dec ;
}
while (con(TRUE / FALSE))
increment / decrement ;
}
while (condition(TRUE / FALSE) )
Copyright © 2015 · Sourav Ganguly · All Rights Reserved.
1
2
3
4
11
5
6
7
8
12
nested do while loop of C language…..
10
9
int loop1,loop2;
loop1=0 ;
do
{
loop2=0 ;
do
{
printf(“%d”,loop2);
loop2=loop2+1;
} while (loop2 < 3) ;
printf(“n”);
printf(“Loop2 end”);
loop1=loop1+1;
} while (loop1 < 3);
printf(“Loop1 end”);
Output:
012
Loop2 end
012
Loop2 end
012
Loop2 end
Loop1 end
Copyright © 2015 · Sourav Ganguly · All Rights Reserved.
nested do while loop of C language….. example
Sourav Ganguly
Please visit my Youtube channel
Step 1: go to www.google.com
Step 2: Search for “sourav ganguly c programming”.
Step 3: Click on my image bottom of the video. You will reach my
channel.
Youtube (direct link):
https://www.youtube.com/channel/UCDsQskBhM107VIYLjg8kczg
Website:
http://www.startselfstudy.blogspot.in
Copyright © 2015 · Sourav Ganguly · All Rights Reserved.

More Related Content

PPTX
C program language tutorial pattern printing
PPT
Different loops in C
PPTX
Loops in C Programming Language
PPTX
Loops in c language
PPTX
Loops in c programming
PDF
Loops in C Programming | for Loop | do-while Loop | while Loop | Nested Loop
PPTX
Looping and Switchcase BDCR
C program language tutorial pattern printing
Different loops in C
Loops in C Programming Language
Loops in c language
Loops in c programming
Loops in C Programming | for Loop | do-while Loop | while Loop | Nested Loop
Looping and Switchcase BDCR

What's hot (20)

PPTX
Presentation on nesting of loops
PPTX
Looping and switch cases
PPSX
Break and continue
PPSX
C lecture 4 nested loops and jumping statements slideshare
PPTX
Do...while loop structure
PPTX
Types of loops in c language
PPTX
Looping statement
DOCX
Looping statements
PPTX
Looping Statement And Flow Chart
PPTX
The Loops
PPT
Iteration
DOC
Jumping statements
PPTX
types of loops and what is loop
PPTX
Loops c++
PPTX
Loops in c
PPT
170120107074 looping statements and nesting of loop statements
PPTX
Nested loop in C language
PPTX
C++ decision making
Presentation on nesting of loops
Looping and switch cases
Break and continue
C lecture 4 nested loops and jumping statements slideshare
Do...while loop structure
Types of loops in c language
Looping statement
Looping statements
Looping Statement And Flow Chart
The Loops
Iteration
Jumping statements
types of loops and what is loop
Loops c++
Loops in c
170120107074 looping statements and nesting of loop statements
Nested loop in C language
C++ decision making
Ad

Viewers also liked (6)

PPTX
Basic for Loop in C
PPTX
Structure in C
PPT
Memory allocation in c
PPT
detailed information about Pointers in c language
PDF
C Prog. - Decision & Loop Controls
PDF
C Pointers
Basic for Loop in C
Structure in C
Memory allocation in c
detailed information about Pointers in c language
C Prog. - Decision & Loop Controls
C Pointers
Ad

Similar to C program language tutorial for loop while loop do while loop (20)

PPT
How to write c programme
PPT
Week2 ch4 part1edited 2020
PPT
Week2 ch4 part1edited 2020
PDF
Arduino programming of ML-style in ATS
PPTX
decision making in c.pptx
PPT
C++ programming
PPT
C++ programming
PDF
Brand New JavaScript - ECMAScript 2015
PPTX
Getting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
PPTX
Switch case and looping
PPT
neiljaysonching
PPT
My programming final proj. (1)
PPTX
Yeahhhh the final requirement!!!
PPTX
Decision Making and Looping
PDF
[Golang] 以 Mobile App 工程師視角,帶你進入 Golang 的世界 (Introduction of GoLang)
PPTX
C Programming Language Part 6
PDF
04-Looping( For , while and do while looping) .pdf
PDF
Enabling Java in Latency Sensitive Environments
PPTX
Switch case and looping kim
How to write c programme
Week2 ch4 part1edited 2020
Week2 ch4 part1edited 2020
Arduino programming of ML-style in ATS
decision making in c.pptx
C++ programming
C++ programming
Brand New JavaScript - ECMAScript 2015
Getting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
Switch case and looping
neiljaysonching
My programming final proj. (1)
Yeahhhh the final requirement!!!
Decision Making and Looping
[Golang] 以 Mobile App 工程師視角,帶你進入 Golang 的世界 (Introduction of GoLang)
C Programming Language Part 6
04-Looping( For , while and do while looping) .pdf
Enabling Java in Latency Sensitive Environments
Switch case and looping kim

Recently uploaded (20)

PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
How to Manage Starshipit in Odoo 18 - Odoo Slides
PDF
From loneliness to social connection charting
PDF
Electrolyte Disturbances and Fluid Management A clinical and physiological ap...
PDF
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
PDF
Pre independence Education in Inndia.pdf
PPTX
UNDER FIVE CLINICS OR WELL BABY CLINICS.pptx
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
The Final Stretch: How to Release a Game and Not Die in the Process.
PPTX
NOI Hackathon - Summer Edition - GreenThumber.pptx
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
English Language Teaching from Post-.pdf
PPTX
Revamp in MTO Odoo 18 Inventory - Odoo Slides
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PDF
Insiders guide to clinical Medicine.pdf
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
STATICS OF THE RIGID BODIES Hibbelers.pdf
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
human mycosis Human fungal infections are called human mycosis..pptx
O7-L3 Supply Chain Operations - ICLT Program
How to Manage Starshipit in Odoo 18 - Odoo Slides
From loneliness to social connection charting
Electrolyte Disturbances and Fluid Management A clinical and physiological ap...
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
Pre independence Education in Inndia.pdf
UNDER FIVE CLINICS OR WELL BABY CLINICS.pptx
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
The Final Stretch: How to Release a Game and Not Die in the Process.
NOI Hackathon - Summer Edition - GreenThumber.pptx
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
English Language Teaching from Post-.pdf
Revamp in MTO Odoo 18 Inventory - Odoo Slides
Abdominal Access Techniques with Prof. Dr. R K Mishra
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Insiders guide to clinical Medicine.pdf
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx

C program language tutorial for loop while loop do while loop

  • 1. C language Loop Control (for , while , do while) Copyright © 2015 · Sourav Ganguly · All Rights Reserved.
  • 2. Sourav Ganguly Please visit my Youtube channel Step 1: go to www.google.com Step 2: Search for “sourav ganguly c programming”. Step 3: Click on my image bottom of the video. You will reach my channel. Youtube (direct link): https://www.youtube.com/channel/UCDsQskBhM107VIYLjg8kczg Website: http://www.startselfstudy.blogspot.in Copyright © 2015 · Sourav Ganguly · All Rights Reserved.
  • 3. for loop of C language….. Different types of for loop in C language….. for loop example with real program….. [Live Demo on YouTube channel] while loop of C language….. Different types of while loop in C language….. while loop example with real program….. [Live Demo on YouTube channel] do while loop of C language….. Different types of do while loop in C language….. do while loop example with real program….. [Live Demo on YouTube channel] Index Copyright © 2015 · Sourav Ganguly · All Rights Reserved.
  • 4. for loop of C language….. for ( initialization ; condition(TRUE / FALSE) ; increment / decrement ) { Task / Job; } int x; for ( x=0 ; x < 3 ; x=x+1 ) { printf(“%d”,x); printf(“n”); } printf(“Loop end”); Output: 0 1 2 Loop end Copyright © 2015 · Sourav Ganguly · All Rights Reserved. 6 1 2 3 4 5
  • 5. for ( initialization ; condition(TRUE / FALSE) ; increment / decrement ) { for ( init ; con(TRUE / FALSE) ; inc / dec ) { Task / Job; } } Copyright © 2015 · Sourav Ganguly · All Rights Reserved. 12 1 2 3 4 11 5 6 7 8 9 10 nested for loop of C language…..
  • 6. int loop1,loop2; for ( loop1=0 ; loop1 < 3 ; loop1=loop1+1 ) { for ( loop2=0 ; loop2 < 3 ; loop2=loop2+1 ) { printf(“%d”,loop2); } printf(“n”); printf(“Loop2 end”); printf(“n”); } printf(“Loop1 end”); Output: 012 Loop2 end 012 Loop2 end 012 Loop2 end Loop1 end Copyright © 2015 · Sourav Ganguly · All Rights Reserved. nested for loop of C language….. example
  • 7. initialization ; while (condition(TRUE / FALSE) ) { Task / Job; increment / decrement ; } int x=0; while ( x < 3 ) { printf(“n%d”,x); x=x+1; } printf(“Loop end”); Output: 0 1 2 Loop end Copyright © 2015 · Sourav Ganguly · All Rights Reserved. 5 1 2 3 4 while loop of C language…..
  • 8. initialization ; while (condition(TRUE / FALSE) ) { init ; while (con(TRUE / FALSE)) { Task / Job; inc / dec ; } increment / decrement ; } Copyright © 2015 · Sourav Ganguly · All Rights Reserved. 1 2 3 4 9 5 6 7 8 10 nested while loop of C language…..
  • 9. int loop1,loop2; loop1=0 ; while (loop1 < 3) { loop2=0 ; while (loop2 < 3) { printf(“%d”,loop2); loop2=loop2+1; } printf(“n”); printf(“Loop2 end”); loop1=loop1+1; } printf(“Loop1 end”); Output: 012 Loop2 end 012 Loop2 end 012 Loop2 end Loop1 end Copyright © 2015 · Sourav Ganguly · All Rights Reserved. nested while loop of C language….. example
  • 10. initialization ; do { Task / Job; increment / decrement ; } while (condition(TRUE / FALSE) ) ; int x=0; do { printf(“n%d”,x); x=x+1; } while( x < 3 ); printf(“Loop end”); Output: 0 1 2 Loop end Copyright © 2015 · Sourav Ganguly · All Rights Reserved. 6 1 2 4 5 do while loop of C language….. 3
  • 11. initialization ; do { init ; do { Task / Job; inc / dec ; } while (con(TRUE / FALSE)) increment / decrement ; } while (condition(TRUE / FALSE) ) Copyright © 2015 · Sourav Ganguly · All Rights Reserved. 1 2 3 4 11 5 6 7 8 12 nested do while loop of C language….. 10 9
  • 12. int loop1,loop2; loop1=0 ; do { loop2=0 ; do { printf(“%d”,loop2); loop2=loop2+1; } while (loop2 < 3) ; printf(“n”); printf(“Loop2 end”); loop1=loop1+1; } while (loop1 < 3); printf(“Loop1 end”); Output: 012 Loop2 end 012 Loop2 end 012 Loop2 end Loop1 end Copyright © 2015 · Sourav Ganguly · All Rights Reserved. nested do while loop of C language….. example
  • 13. Sourav Ganguly Please visit my Youtube channel Step 1: go to www.google.com Step 2: Search for “sourav ganguly c programming”. Step 3: Click on my image bottom of the video. You will reach my channel. Youtube (direct link): https://www.youtube.com/channel/UCDsQskBhM107VIYLjg8kczg Website: http://www.startselfstudy.blogspot.in Copyright © 2015 · Sourav Ganguly · All Rights Reserved.