SlideShare ist ein Scribd-Unternehmen logo
1 von 16
{
LOOPING IN C-
PROGRAMMING
PRESENTED BY :
AFANJI PHILL MUKETE
BUWAGA RYAN ARREY
NWANKO FORGIVE
FUHNWIE HILLSON NGWASIRI
BALALA OLIVIER
At the end this presentation, you should be able to:
 Define a looping as concern C-programming
 Why we loop in C-programming
 Advantages of looping
 Types of C loops
 Essential components of a loop
 Discuss on While loop and examples
 Discuss on Do loop and examples
 Discuss on the For loop and examples
 Draw flowchart for the various types of looping in
C-programming
OUTLINE
 The looping can be defined as repeating the same
process multiple times until a specific condition
Satisfies or is true. The sequence of statements to be
executed is kept inside the curly bracket { }known as
loop body , condition is verified, and if it is found to
be true the loop body is executed again. And when
the condition check false, the loop body is not
executed
WHAT IS LOOPING IN C-
PROGRAMMING?
 Looping simplifies the complex problems into the
easy ones.
 Looping enables to alter the flow of the program so
that instead of writing the same code again and
again, we can execute the same code for a finite
number of times.
 For example, if we need to print “UNIVERSITY OF
FOMIC POLYTECHNIC” 15-times then, we can use
the Printf once inside a loop which runs up to 15
iterations.
Why we loop in C-Programming ?
 It provides codes reusability.
 Using loops we do not need to write the same
code again and again.
 Using loops, we can access each elements
stored in the array so that the data can be
checked or used as part of the process. data
structure (array is a series of memory location
which holds a single item of data).
Advantages of looping in C-
Programming
There are three types of loops in C language those
are given below;
 While
 Do while
 For
Types of C Loops
 Counter
 Initialization of the counter with initial value
 Condition to check with the optimum value of the
counter
 Statement(s) to be executed by iteration
 Increment/decrement
Essential components of a loop
 Thewhileloopincistobeusedinthescenariowhere
theblockofstatementsisexecutedinthewhileloopuntil
theconditionspecifiedinthewhileloopissatisfied.Itisalso
calledapre-testedloop.
 Thesyntaxofwhileloopinclanguageisgivenbelow:
initialization;
While(condition)
{
blockofthestatementstobeexecuted;
increment;
}
While loop in C
 Thedo-whileloopcontinuesuntilagivencondition
satisfies.Itisalsocalledposttestedloop.Itisusedwhenitis
necessarytoexecutetheloopatleastonce(mostlymenu
drivenprograms).
 Thesyntaxofdo-whileloopinclanguageisgivenbelow;
do
{
codetobeexecuted;
}
While(condition);
Do-while loop in C
• TheforloopinC languageisusedtoiteratethe
statementsorapartoftheprogramseveraltimes.It
isfrequentlyusedtotraversethedatastructureslike
thearrayandlinkedlist.
•Thesyntaxofforloopinclanguageisgivenbelow:
for(expression1;Expression2;Expression3)
{
codestobeexecuted;
}
For loop in C
 Expression 1 (Optional)
• Representstheinitializationoftheloopvariable.
•Morethanonevariablecanbeinitialized.
 Expression 2
•Expression2isaconditionalexpression.Itchecksfora
specificconditiontobesatisfied.Ifitisnot,theloopis
terminated.
•Expression2canhavemorethanonecondition.However,
theloopwilliterateuntilthelastconditionbecomesfalse.
Otherconditionswillbetreatedasstatements.
 Expression3
• Expression 3 is increment or decrement to update
the value of the loop variable
 Flowchart : For the or loop
{
Example of While loop print even numbers
1. //print even numbers
2. #include<stdio.h>
3. int main ( )
4. {
5. int n, i=0;
6. printf (“/n Enter a number : “) ;
7. scanf(“ % d” ,&n);
8. while ( i < = n )
9. {
10. if ( i % 2= =0)
11. printf (“/n%d” , i ) ;
12. i + +;
13. }
14. return 0
Example of a DO-while loop
Example of a For Loop in C
LOOPING IN C- PROGRAMMING.pptx

Weitere ähnliche Inhalte

Ähnlich wie LOOPING IN C- PROGRAMMING.pptx

Final project powerpoint template (fndprg) (1)
Final project powerpoint template (fndprg) (1)Final project powerpoint template (fndprg) (1)
Final project powerpoint template (fndprg) (1)
jewelyngrace
 

Ähnlich wie LOOPING IN C- PROGRAMMING.pptx (20)

Cpp loop types
Cpp loop typesCpp loop types
Cpp loop types
 
loops and iteration.docx
loops and iteration.docxloops and iteration.docx
loops and iteration.docx
 
While loop and for loop 06 (js)
While loop and for loop 06 (js)While loop and for loop 06 (js)
While loop and for loop 06 (js)
 
Learn C# Programming - Decision Making & Loops
Learn C# Programming - Decision Making & LoopsLearn C# Programming - Decision Making & Loops
Learn C# Programming - Decision Making & Loops
 
C loops
C loopsC loops
C loops
 
Decision making and loop in C#
Decision making and loop in C#Decision making and loop in C#
Decision making and loop in C#
 
C++ programming
C++ programmingC++ programming
C++ programming
 
Loops in C Programming | for Loop | do-while Loop | while Loop | Nested Loop
Loops in C Programming | for Loop | do-while Loop | while Loop | Nested LoopLoops in C Programming | for Loop | do-while Loop | while Loop | Nested Loop
Loops in C Programming | for Loop | do-while Loop | while Loop | Nested Loop
 
whileloop-161225171903.pdf
whileloop-161225171903.pdfwhileloop-161225171903.pdf
whileloop-161225171903.pdf
 
prt123.pptx
prt123.pptxprt123.pptx
prt123.pptx
 
Loop structures
Loop structuresLoop structures
Loop structures
 
While loop
While loopWhile loop
While loop
 
C++ programming
C++ programmingC++ programming
C++ programming
 
Chapter 3 - Flow of Control Part II.pdf
Chapter 3  - Flow of Control Part II.pdfChapter 3  - Flow of Control Part II.pdf
Chapter 3 - Flow of Control Part II.pdf
 
Loops in C.pptx
Loops in C.pptxLoops in C.pptx
Loops in C.pptx
 
Final project powerpoint template (fndprg) (1)
Final project powerpoint template (fndprg) (1)Final project powerpoint template (fndprg) (1)
Final project powerpoint template (fndprg) (1)
 
Loops
LoopsLoops
Loops
 
Loops in c
Loops in cLoops in c
Loops in c
 
2nd year computer science chapter 12 notes
2nd year computer science chapter 12 notes2nd year computer science chapter 12 notes
2nd year computer science chapter 12 notes
 
Question Pattern in Structure Programming
Question Pattern in Structure ProgrammingQuestion Pattern in Structure Programming
Question Pattern in Structure Programming
 

Kürzlich hochgeladen

result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
Tonystark477637
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Dr.Costas Sachpazis
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Christo Ananth
 

Kürzlich hochgeladen (20)

The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spain
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 

LOOPING IN C- PROGRAMMING.pptx