SlideShare a Scribd company logo
Presentation
on
Different loops in C
1
Dhaka International University
Dhaka International University
Presented By-
Md. Arif Hossain
Department of EETE (Evening)
Batch- 31st
Roll No- 33
Reg. No- EE-E-15-31-101055
2
Content
 What is Programming?
 What is Structured Programming?
 What is Loops?
 Sample program using for, while & do/while loops
Dhaka International University
3
What is programming?
 Programming is the technique way to accomplish a task or to
solve a problem by using program.
What is Structured programming?
 Structured programming (sometimes known as modular
Programming) is a subset of procedural programming that
enforces a logical structure on the program being written to
make it more efficient and easier to understand and modify.
Structured programming works as modules.
Dhaka International University
4
What is Loops?
 In C and all other Programming languages, loops allow a set
of instructions to be performed until a certain condition is
reached. This condition may be predefined as in the for loop, or
open-ended as in the while and do loops.
Dhaka International University
5
For loops (initialization; condition; increment) statement
 An important point about for loop is that the conditional test is always
Performed at the top of the loop
//A Program for a Inverted Pyramid using for loop
#include<stdio.h>
#include<conio.h>
void main ()
{
int i, j;
clrscr();
for (i=0; i<5; i++)
{
for(j=i; j<=4;j++)
printf("*");
printf("n");
getch();
}
6
Dhaka International University
Output:
************
*
7
**
while loops (condition) statement
 for & while loops performs in the same way that means while loops
check the test condition at the top of the loop. for & while loops is called
entry controlled loops.
//A Program using while loop
#include<stdio.h>
#include<conio.h>
void main ()
{
int i=0;
clrscr();
while (i<2)
{
printf("Done Before?n");
i++;
}
printf ("Not Sure!");
getch();
}
8
Dhaka International University
Output:
Done Before?
Done Before??
Not Sure!
9
do/while loops do{
Statement sequence;
}
while(condition);
 for & do/while loops checks its condition at the bottom of the loop. Its
called exit controlled loops.
//A Program using do/while loop
#include<stdio.h>
#include<conio.h>
void main ()
{
int i=0;
clrscr();
do
{
printf("Done Before?n");
i++;
}
While (i<2);
printf ("Not Sure!");
getch();
}
10
Dhaka International University
Output:
Done Before?
Done Before??
Done Before???
Not Sure!
11
Dhaka International University
12
Dhaka International University
13

More Related Content

What's hot

While , For , Do-While Loop
While , For , Do-While LoopWhile , For , Do-While Loop
While , For , Do-While Loop
Abhishek Choksi
 
Forloop
ForloopForloop
Forloop
Dipen Vasoya
 
Jumping statements
Jumping statementsJumping statements
Jumping statementsSuneel Dogra
 
Loop(for, while, do while) condition Presentation
Loop(for, while, do while) condition PresentationLoop(for, while, do while) condition Presentation
Loop(for, while, do while) condition Presentation
Badrul Alam
 
Control structure of c
Control structure of cControl structure of c
Control structure of c
Komal Kotak
 
Unit II chapter 4 Loops in C
Unit II chapter 4 Loops in CUnit II chapter 4 Loops in C
Unit II chapter 4 Loops in C
Sowmya Jyothi
 
Decision Making and Branching in C
Decision Making and Branching  in CDecision Making and Branching  in C
Decision Making and Branching in C
RAJ KUMAR
 
Decision Making and Looping
Decision Making and LoopingDecision Making and Looping
Decision Making and Looping
Munazza-Mah-Jabeen
 
Loops in C
Loops in CLoops in C
Loops in C
Kamal Acharya
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
Wingston
 
Loops
LoopsLoops
C lecture 3 control statements slideshare
C lecture 3 control statements slideshareC lecture 3 control statements slideshare
C lecture 3 control statements slideshare
Gagan Deep
 
Loops in C Programming Language
Loops in C Programming LanguageLoops in C Programming Language
Loops in C Programming Language
Mahantesh Devoor
 
Decision making and looping
Decision making and loopingDecision making and looping
Decision making and looping
Hossain Md Shakhawat
 
Control structures in c++
Control structures in c++Control structures in c++
Control structures in c++
Nitin Jawla
 
C programming basics
C  programming basicsC  programming basics
C programming basics
argusacademy
 
String in c
String in cString in c
String in c
Suneel Dogra
 
types of loops and what is loop
types of loops and what is looptypes of loops and what is loop
types of loops and what is loop
waheed dogar
 
Presentation on C++ Programming Language
Presentation on C++ Programming LanguagePresentation on C++ Programming Language
Presentation on C++ Programming Language
satvirsandhu9
 

What's hot (20)

While , For , Do-While Loop
While , For , Do-While LoopWhile , For , Do-While Loop
While , For , Do-While Loop
 
Forloop
ForloopForloop
Forloop
 
Jumping statements
Jumping statementsJumping statements
Jumping statements
 
Loop(for, while, do while) condition Presentation
Loop(for, while, do while) condition PresentationLoop(for, while, do while) condition Presentation
Loop(for, while, do while) condition Presentation
 
Control structure of c
Control structure of cControl structure of c
Control structure of c
 
Unit II chapter 4 Loops in C
Unit II chapter 4 Loops in CUnit II chapter 4 Loops in C
Unit II chapter 4 Loops in C
 
Decision Making and Branching in C
Decision Making and Branching  in CDecision Making and Branching  in C
Decision Making and Branching in C
 
Decision Making and Looping
Decision Making and LoopingDecision Making and Looping
Decision Making and Looping
 
Loops in C
Loops in CLoops in C
Loops in C
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
 
Loops
LoopsLoops
Loops
 
Chap 6(decision making-looping)
Chap 6(decision making-looping)Chap 6(decision making-looping)
Chap 6(decision making-looping)
 
C lecture 3 control statements slideshare
C lecture 3 control statements slideshareC lecture 3 control statements slideshare
C lecture 3 control statements slideshare
 
Loops in C Programming Language
Loops in C Programming LanguageLoops in C Programming Language
Loops in C Programming Language
 
Decision making and looping
Decision making and loopingDecision making and looping
Decision making and looping
 
Control structures in c++
Control structures in c++Control structures in c++
Control structures in c++
 
C programming basics
C  programming basicsC  programming basics
C programming basics
 
String in c
String in cString in c
String in c
 
types of loops and what is loop
types of loops and what is looptypes of loops and what is loop
types of loops and what is loop
 
Presentation on C++ Programming Language
Presentation on C++ Programming LanguagePresentation on C++ Programming Language
Presentation on C++ Programming Language
 

Similar to Different loops in C

Loops in C.pptx
Loops in C.pptxLoops in C.pptx
Loops in C.pptx
nagalakshmig4
 
Question Pattern in Structure Programming
Question Pattern in Structure ProgrammingQuestion Pattern in Structure Programming
Question Pattern in Structure Programming
Suman Mia
 
Loops in c
Loops in cLoops in c
Loops in c
shubhampandav3
 
etlplooping-170320213203.pptx
etlplooping-170320213203.pptxetlplooping-170320213203.pptx
etlplooping-170320213203.pptx
ffyuyufyfufufufu
 
1584503386 1st chap
1584503386 1st chap1584503386 1st chap
1584503386 1st chapthuhiendtk4
 
decision making in c.pptx
decision making in c.pptxdecision making in c.pptx
decision making in c.pptx
DrGAMBIKA
 
C_Language_PS&PC_Notes.ppt
C_Language_PS&PC_Notes.pptC_Language_PS&PC_Notes.ppt
C_Language_PS&PC_Notes.ppt
ganeshkarthy
 
Password protected diary
Password protected diaryPassword protected diary
Password protected diary
SHARDA SHARAN
 
C Programming Unit-2
C Programming Unit-2C Programming Unit-2
C Programming Unit-2
Vikram Nandini
 
Programming in C
Programming in CProgramming in C
Programming in C
Nishant Munjal
 
65_96195_CC112_2014_1__1_1_week1.pdf
65_96195_CC112_2014_1__1_1_week1.pdf65_96195_CC112_2014_1__1_1_week1.pdf
65_96195_CC112_2014_1__1_1_week1.pdf
AhmedEmadElGhetany
 
9. control statement
9. control statement9. control statement
9. control statement
Zambales National High School
 
APP_Unit 1_updated.pptx
APP_Unit 1_updated.pptxAPP_Unit 1_updated.pptx
APP_Unit 1_updated.pptx
gogulram2
 
Object oriented programming system with C++
Object oriented programming system with C++Object oriented programming system with C++
Object oriented programming system with C++
msharshitha03s
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
Dwight Sabio
 
Java chapter 5
Java chapter 5Java chapter 5
Java chapter 5
Mukesh Tekwani
 
LOOPING_STATEMENT c++ pptx from bgctub university
LOOPING_STATEMENT c++ pptx from bgctub universityLOOPING_STATEMENT c++ pptx from bgctub university
LOOPING_STATEMENT c++ pptx from bgctub university
jebinchowdhury68
 

Similar to Different loops in C (20)

Loops in C.pptx
Loops in C.pptxLoops in C.pptx
Loops in C.pptx
 
Question Pattern in Structure Programming
Question Pattern in Structure ProgrammingQuestion Pattern in Structure Programming
Question Pattern in Structure Programming
 
Loops in c
Loops in cLoops in c
Loops in c
 
etlplooping-170320213203.pptx
etlplooping-170320213203.pptxetlplooping-170320213203.pptx
etlplooping-170320213203.pptx
 
1584503386 1st chap
1584503386 1st chap1584503386 1st chap
1584503386 1st chap
 
decision making in c.pptx
decision making in c.pptxdecision making in c.pptx
decision making in c.pptx
 
PHP slides
PHP slidesPHP slides
PHP slides
 
C_Language_PS&PC_Notes.ppt
C_Language_PS&PC_Notes.pptC_Language_PS&PC_Notes.ppt
C_Language_PS&PC_Notes.ppt
 
Ch3 repetition
Ch3 repetitionCh3 repetition
Ch3 repetition
 
Password protected diary
Password protected diaryPassword protected diary
Password protected diary
 
C Programming Unit-2
C Programming Unit-2C Programming Unit-2
C Programming Unit-2
 
Programming in C
Programming in CProgramming in C
Programming in C
 
65_96195_CC112_2014_1__1_1_week1.pdf
65_96195_CC112_2014_1__1_1_week1.pdf65_96195_CC112_2014_1__1_1_week1.pdf
65_96195_CC112_2014_1__1_1_week1.pdf
 
9. control statement
9. control statement9. control statement
9. control statement
 
APP_Unit 1_updated.pptx
APP_Unit 1_updated.pptxAPP_Unit 1_updated.pptx
APP_Unit 1_updated.pptx
 
Object oriented programming system with C++
Object oriented programming system with C++Object oriented programming system with C++
Object oriented programming system with C++
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Compiler design
Compiler designCompiler design
Compiler design
 
Java chapter 5
Java chapter 5Java chapter 5
Java chapter 5
 
LOOPING_STATEMENT c++ pptx from bgctub university
LOOPING_STATEMENT c++ pptx from bgctub universityLOOPING_STATEMENT c++ pptx from bgctub university
LOOPING_STATEMENT c++ pptx from bgctub university
 

More from Md. Arif Hossain

Avada Brochure and Reviewing
Avada Brochure and ReviewingAvada Brochure and Reviewing
Avada Brochure and Reviewing
Md. Arif Hossain
 
Light Detector
Light Detector Light Detector
Light Detector
Md. Arif Hossain
 
Real Life Problems and it’s Solution by technology
Real Life Problems  and it’s Solution by technologyReal Life Problems  and it’s Solution by technology
Real Life Problems and it’s Solution by technology
Md. Arif Hossain
 
INTEL 8086 MP Architecture
INTEL 8086 MP ArchitectureINTEL 8086 MP Architecture
INTEL 8086 MP Architecture
Md. Arif Hossain
 
Introduction to Digital Signal Processing (DSP)
Introduction  to  Digital Signal Processing (DSP)Introduction  to  Digital Signal Processing (DSP)
Introduction to Digital Signal Processing (DSP)
Md. Arif Hossain
 
Introduction to Instrument and Measurement Device
Introduction  to  Instrument and Measurement DeviceIntroduction  to  Instrument and Measurement Device
Introduction to Instrument and Measurement Device
Md. Arif Hossain
 
VoIP
VoIPVoIP

More from Md. Arif Hossain (7)

Avada Brochure and Reviewing
Avada Brochure and ReviewingAvada Brochure and Reviewing
Avada Brochure and Reviewing
 
Light Detector
Light Detector Light Detector
Light Detector
 
Real Life Problems and it’s Solution by technology
Real Life Problems  and it’s Solution by technologyReal Life Problems  and it’s Solution by technology
Real Life Problems and it’s Solution by technology
 
INTEL 8086 MP Architecture
INTEL 8086 MP ArchitectureINTEL 8086 MP Architecture
INTEL 8086 MP Architecture
 
Introduction to Digital Signal Processing (DSP)
Introduction  to  Digital Signal Processing (DSP)Introduction  to  Digital Signal Processing (DSP)
Introduction to Digital Signal Processing (DSP)
 
Introduction to Instrument and Measurement Device
Introduction  to  Instrument and Measurement DeviceIntroduction  to  Instrument and Measurement Device
Introduction to Instrument and Measurement Device
 
VoIP
VoIPVoIP
VoIP
 

Recently uploaded

Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
Kamal Acharya
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
Kamal Acharya
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
abh.arya
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
MuhammadTufail242431
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
Kamal Acharya
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 

Recently uploaded (20)

Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 

Different loops in C

  • 1. Presentation on Different loops in C 1 Dhaka International University
  • 2. Dhaka International University Presented By- Md. Arif Hossain Department of EETE (Evening) Batch- 31st Roll No- 33 Reg. No- EE-E-15-31-101055 2
  • 3. Content  What is Programming?  What is Structured Programming?  What is Loops?  Sample program using for, while & do/while loops Dhaka International University 3
  • 4. What is programming?  Programming is the technique way to accomplish a task or to solve a problem by using program. What is Structured programming?  Structured programming (sometimes known as modular Programming) is a subset of procedural programming that enforces a logical structure on the program being written to make it more efficient and easier to understand and modify. Structured programming works as modules. Dhaka International University 4
  • 5. What is Loops?  In C and all other Programming languages, loops allow a set of instructions to be performed until a certain condition is reached. This condition may be predefined as in the for loop, or open-ended as in the while and do loops. Dhaka International University 5
  • 6. For loops (initialization; condition; increment) statement  An important point about for loop is that the conditional test is always Performed at the top of the loop //A Program for a Inverted Pyramid using for loop #include<stdio.h> #include<conio.h> void main () { int i, j; clrscr(); for (i=0; i<5; i++) { for(j=i; j<=4;j++) printf("*"); printf("n"); getch(); } 6
  • 8. while loops (condition) statement  for & while loops performs in the same way that means while loops check the test condition at the top of the loop. for & while loops is called entry controlled loops. //A Program using while loop #include<stdio.h> #include<conio.h> void main () { int i=0; clrscr(); while (i<2) { printf("Done Before?n"); i++; } printf ("Not Sure!"); getch(); } 8
  • 9. Dhaka International University Output: Done Before? Done Before?? Not Sure! 9
  • 10. do/while loops do{ Statement sequence; } while(condition);  for & do/while loops checks its condition at the bottom of the loop. Its called exit controlled loops. //A Program using do/while loop #include<stdio.h> #include<conio.h> void main () { int i=0; clrscr(); do { printf("Done Before?n"); i++; } While (i<2); printf ("Not Sure!"); getch(); } 10
  • 11. Dhaka International University Output: Done Before? Done Before?? Done Before??? Not Sure! 11

Editor's Notes

  1. Variant control, when exit, repeated control
  2. Variant control, when exit, repeated control
  3. Variant control, when exit, repeated control