SlideShare une entreprise Scribd logo
1  sur  13
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

Contenu connexe

Tendances

Jumping statements
Jumping statementsJumping statements
Jumping statements
Suneel Dogra
 

Tendances (20)

The Loops
The LoopsThe Loops
The Loops
 
C Programming: Control Structure
C Programming: Control StructureC Programming: Control Structure
C Programming: Control Structure
 
C lecture 4 nested loops and jumping statements slideshare
C lecture 4 nested loops and jumping statements slideshareC lecture 4 nested loops and jumping statements slideshare
C lecture 4 nested loops and jumping statements slideshare
 
Types of loops in c language
Types of loops in c languageTypes of loops in c language
Types of loops in c language
 
Decision making and branching in c programming
Decision making and branching in c programmingDecision making and branching in c programming
Decision making and branching in c programming
 
While , For , Do-While Loop
While , For , Do-While LoopWhile , For , Do-While Loop
While , For , Do-While Loop
 
Decision Making Statement in C ppt
Decision Making Statement in C pptDecision Making Statement in C ppt
Decision Making Statement in C ppt
 
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
 
Storage class in C Language
Storage class in C LanguageStorage class in C Language
Storage class in C Language
 
Looping statement in python
Looping statement in pythonLooping statement in python
Looping statement in python
 
Presentation on C Switch Case Statements
Presentation on C Switch Case StatementsPresentation on C Switch Case Statements
Presentation on C Switch Case Statements
 
If statements in c programming
If statements in c programmingIf statements in c programming
If statements in c programming
 
C – operators and expressions
C – operators and expressionsC – operators and expressions
C – operators and expressions
 
Loops c++
Loops c++Loops c++
Loops c++
 
Loops in C
Loops in CLoops in C
Loops in C
 
Python Programming Language | Python Classes | Python Tutorial | Python Train...
Python Programming Language | Python Classes | Python Tutorial | Python Train...Python Programming Language | Python Classes | Python Tutorial | Python Train...
Python Programming Language | Python Classes | Python Tutorial | Python Train...
 
Python unit 3 and Unit 4
Python unit 3 and Unit 4Python unit 3 and Unit 4
Python unit 3 and Unit 4
 
Control statements in c
Control statements in cControl statements in c
Control statements in c
 
Strings
StringsStrings
Strings
 
Jumping statements
Jumping statementsJumping statements
Jumping statements
 

Similaire à Different loops in C

1584503386 1st chap
1584503386 1st chap1584503386 1st chap
1584503386 1st chap
thuhiendtk4
 

Similaire à 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
 
Decision Making and Looping
Decision Making and LoopingDecision Making and Looping
Decision Making and Looping
 
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
 
C lecture 3 control statements slideshare
C lecture 3 control statements slideshareC lecture 3 control statements slideshare
C lecture 3 control statements slideshare
 
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
 

Plus de Md. Arif Hossain

Plus de 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
 

Dernier

scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
HenryBriggs2
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Epec Engineered Technologies
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 

Dernier (20)

AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
 
Introduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdfIntroduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdf
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
 

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

Notes de l'éditeur

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