SlideShare a Scribd company logo
1 of 16
1
Gandhinagar Institute Of Technology
Subject: CPU (2110003)
Looping Statements, Nesting of Loop Statements
Prepared by: Tarj Mehta
Enrollment No: 201707000179
Guided by- Mrs.Hetal Shah
2
What is Looping?
●
Repeating the same path again and again is called
looping.
●
The same path is repeated till the desired output is
obtained.
●
A simple life problem of looping can be understood by
example of searching the name from telephone directory
and repeating the process letter by letter till the desired
name is obtained.
3
What is Looping in C?
●
In C programming, looping is a sequence of instructions
that is continuously repeated until a certain condition is
reached.
●
The programming is done is such a way that certain
conditions are checked.
●
If the conditions are satisfied, then only output is
obtained.
4
Why is looping used?
●
If we want to print ‘HI’ 100 times it is not a willing work to
implement ‘printf’ command 100 times.
●
There are more chances to make mistake.
●
If any error is found, it is very boring job to search for it
in 100 printf commands executed.
●
Thus to save time and mistake looping is used.
5
Types of Loop Statements in C
●
Loop provides a way to repeat command and control
how many times it is repeated.
●
Types of loop:
1. For
2. While
3. Do...while
6
For Loop
●
Syntax
●
for(initialization;condition;inc
r/decr)
●
Flowchart
●
7
For Loop
●
For loop is called entry control
loop as it checks the condition
while entering the loop.
●
The loop is repeated till the
given condition is satisfied,
once the condition is not
satisfied the loop is terminated
and program comes to next
statement.
8
While loop
●
Syntax
●
while(condition)
{
execute statements//
}
●
Flowchart
●
9
While Loop
●
While loop is also called
entry control loop as it
checks the condition during
entering the loop.
●
Once the condition is
satisfied, loop is executed
and the printf statement in it
is executed and incr/decr is
done for next condition
checking.
10
Do.....while Loop
●
Syntax
●
do
{
execute statement//
} while(condition)
●
Flowchart
●
11
Do.....while Loop
●
Do...while loop is also
known as exit control loop
as the condition is
checked during exit of
loop.
●
In false condition also the
output statement is
printed atleast once.
12
Nesting of Loop Statements
●
Loop within a loop is called Nested loop and this action
is called Nesting of loop statements.
●
One loop is kept inside the body of first loop.
●
Number of nested loops are also possible.
13
Nesting of loops
●
Syntax
●
loop1
{
loop2
{
execute statements//
}
}
●
Flowchart
●
14
Example of Nested loop
●
The nesting of loop is
executed when condition
of first loop is true.
●
The outer loop takes
control of number of
complete repetitions of
inner loop.
●
The most common nested
loop is ‘for’ loop.
15
Conclusion
●
Looping saves time.
●
It is easy to execute.
●
It decreases the possibilities of mistakes while
programming.
●
Nesting of loop allows us to write more complex
programs.
16
The End
Thank you

More Related Content

What's hot (20)

While , For , Do-While Loop
While , For , Do-While LoopWhile , For , Do-While Loop
While , For , Do-While Loop
 
Iteration Statement in C++
Iteration Statement in C++Iteration Statement in C++
Iteration Statement in C++
 
Looping and Switchcase BDCR
Looping and Switchcase BDCRLooping and Switchcase BDCR
Looping and Switchcase BDCR
 
Looping statement
Looping statementLooping statement
Looping statement
 
Loops c++
Loops c++Loops c++
Loops c++
 
Loops in C Programming Language
Loops in C Programming LanguageLoops in C Programming Language
Loops in C Programming Language
 
While loop
While loopWhile loop
While loop
 
Iteration
IterationIteration
Iteration
 
Loops IN COMPUTER SCIENCE STANDARD 11 BY KR
Loops IN COMPUTER SCIENCE STANDARD 11 BY KRLoops IN COMPUTER SCIENCE STANDARD 11 BY KR
Loops IN COMPUTER SCIENCE STANDARD 11 BY KR
 
3.looping(iteration statements)
3.looping(iteration statements)3.looping(iteration statements)
3.looping(iteration statements)
 
Nested loop in C language
Nested loop in C languageNested loop in C language
Nested loop in C language
 
Looping in c++
Looping in c++Looping in c++
Looping in c++
 
Presentation on nesting of loops
Presentation on nesting of loopsPresentation on nesting of loops
Presentation on nesting of loops
 
Loops Basics
Loops BasicsLoops Basics
Loops Basics
 
Loops in c language
Loops in c languageLoops in c language
Loops in c language
 
Looping in c++
Looping in c++Looping in c++
Looping in c++
 
Looping
LoopingLooping
Looping
 
Vb.net (loop structure)
Vb.net (loop structure)Vb.net (loop structure)
Vb.net (loop structure)
 
C++ loop
C++ loop C++ loop
C++ loop
 
Different loops in C
Different loops in CDifferent loops in C
Different loops in C
 

Similar to 170120107074 looping statements and nesting of loop statements

loops and iteration.docx
loops and iteration.docxloops and iteration.docx
loops and iteration.docxJavvajiVenkat
 
Object oriented programming18 control structures looping
Object oriented programming18 control structures loopingObject oriented programming18 control structures looping
Object oriented programming18 control structures loopingVaibhav Khanna
 
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 LoopPriyom Majumder
 
Control Statement IN C.pptx
Control Statement IN C.pptxControl Statement IN C.pptx
Control Statement IN C.pptxsujatha629799
 
Loop and while Loop
Loop and while LoopLoop and while Loop
Loop and while LoopJayBhavsar68
 
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 CSowmya Jyothi
 
Programming in python - Week 4
Programming in python  - Week 4Programming in python  - Week 4
Programming in python - Week 4Priya Nayak
 
While-For-loop in python used in college
While-For-loop in python used in collegeWhile-For-loop in python used in college
While-For-loop in python used in collegessuser7a7cd61
 
Loop (Computer programming and utilization)
Loop (Computer programming and utilization)Loop (Computer programming and utilization)
Loop (Computer programming and utilization)Digvijaysinh Gohil
 
Going loopy - Introduction to Loops.pptx
Going loopy - Introduction to Loops.pptxGoing loopy - Introduction to Loops.pptx
Going loopy - Introduction to Loops.pptxAmy Nightingale
 
03 conditions loops
03   conditions loops03   conditions loops
03 conditions loopsManzoor ALam
 
3. Flow Controls in C (Part II).pdf
3. Flow Controls in C (Part II).pdf3. Flow Controls in C (Part II).pdf
3. Flow Controls in C (Part II).pdfsantosh147365
 

Similar to 170120107074 looping statements and nesting of loop statements (20)

loops and iteration.docx
loops and iteration.docxloops and iteration.docx
loops and iteration.docx
 
Object oriented programming18 control structures looping
Object oriented programming18 control structures loopingObject oriented programming18 control structures looping
Object oriented programming18 control structures looping
 
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
 
Control Statement IN C.pptx
Control Statement IN C.pptxControl Statement IN C.pptx
Control Statement IN C.pptx
 
Loops in R
Loops in RLoops in R
Loops in R
 
C loops
C loopsC loops
C loops
 
Loop and while Loop
Loop and while LoopLoop and while Loop
Loop and while Loop
 
Loops in c
Loops in cLoops in c
Loops in c
 
Loops
LoopsLoops
Loops
 
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
 
Programming in python - Week 4
Programming in python  - Week 4Programming in python  - Week 4
Programming in python - Week 4
 
While-For-loop in python used in college
While-For-loop in python used in collegeWhile-For-loop in python used in college
While-For-loop in python used in college
 
Ch3 repetition
Ch3 repetitionCh3 repetition
Ch3 repetition
 
Loop (Computer programming and utilization)
Loop (Computer programming and utilization)Loop (Computer programming and utilization)
Loop (Computer programming and utilization)
 
Going loopy - Introduction to Loops.pptx
Going loopy - Introduction to Loops.pptxGoing loopy - Introduction to Loops.pptx
Going loopy - Introduction to Loops.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++
 
Loops in c++ programming language
Loops in c++ programming language Loops in c++ programming language
Loops in c++ programming language
 
Fundamentals of Programming Chapter 7
Fundamentals of Programming Chapter 7Fundamentals of Programming Chapter 7
Fundamentals of Programming Chapter 7
 
03 conditions loops
03   conditions loops03   conditions loops
03 conditions loops
 
3. Flow Controls in C (Part II).pdf
3. Flow Controls in C (Part II).pdf3. Flow Controls in C (Part II).pdf
3. Flow Controls in C (Part II).pdf
 

More from harsh kothari

Instructuion set of 8085
Instructuion set of 8085Instructuion set of 8085
Instructuion set of 8085harsh kothari
 
Fractional Knapsack Problem
Fractional Knapsack ProblemFractional Knapsack Problem
Fractional Knapsack Problemharsh kothari
 
stirling method maths
stirling method mathsstirling method maths
stirling method mathsharsh kothari
 
170120107066 dielectric.ppt
170120107066 dielectric.ppt170120107066 dielectric.ppt
170120107066 dielectric.pptharsh kothari
 
170120107066 chronemics.ppt
170120107066 chronemics.ppt170120107066 chronemics.ppt
170120107066 chronemics.pptharsh kothari
 
170120107066 power series.ppt
170120107066 power series.ppt170120107066 power series.ppt
170120107066 power series.pptharsh kothari
 
170120107066 flowchart.ppt
170120107066 flowchart.ppt170120107066 flowchart.ppt
170120107066 flowchart.pptharsh kothari
 

More from harsh kothari (11)

Instructuion set of 8085
Instructuion set of 8085Instructuion set of 8085
Instructuion set of 8085
 
Java(Polymorphism)
Java(Polymorphism)Java(Polymorphism)
Java(Polymorphism)
 
Fractional Knapsack Problem
Fractional Knapsack ProblemFractional Knapsack Problem
Fractional Knapsack Problem
 
stirling method maths
stirling method mathsstirling method maths
stirling method maths
 
170120107066 dbms
170120107066 dbms170120107066 dbms
170120107066 dbms
 
170120107066 dielectric.ppt
170120107066 dielectric.ppt170120107066 dielectric.ppt
170120107066 dielectric.ppt
 
Hk
HkHk
Hk
 
170120107066 chronemics.ppt
170120107066 chronemics.ppt170120107066 chronemics.ppt
170120107066 chronemics.ppt
 
170120107066 power series.ppt
170120107066 power series.ppt170120107066 power series.ppt
170120107066 power series.ppt
 
170120107066 flowchart.ppt
170120107066 flowchart.ppt170120107066 flowchart.ppt
170120107066 flowchart.ppt
 
control circuit
 control circuit control circuit
control circuit
 

Recently uploaded

pipeline in computer architecture design
pipeline in computer architecture  designpipeline in computer architecture  design
pipeline in computer architecture designssuser87fa0c1
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
Effects of rheological properties on mixing
Effects of rheological properties on mixingEffects of rheological properties on mixing
Effects of rheological properties on mixingviprabot1
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 

Recently uploaded (20)

9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
pipeline in computer architecture design
pipeline in computer architecture  designpipeline in computer architecture  design
pipeline in computer architecture design
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
Effects of rheological properties on mixing
Effects of rheological properties on mixingEffects of rheological properties on mixing
Effects of rheological properties on mixing
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 

170120107074 looping statements and nesting of loop statements

  • 1. 1 Gandhinagar Institute Of Technology Subject: CPU (2110003) Looping Statements, Nesting of Loop Statements Prepared by: Tarj Mehta Enrollment No: 201707000179 Guided by- Mrs.Hetal Shah
  • 2. 2 What is Looping? ● Repeating the same path again and again is called looping. ● The same path is repeated till the desired output is obtained. ● A simple life problem of looping can be understood by example of searching the name from telephone directory and repeating the process letter by letter till the desired name is obtained.
  • 3. 3 What is Looping in C? ● In C programming, looping is a sequence of instructions that is continuously repeated until a certain condition is reached. ● The programming is done is such a way that certain conditions are checked. ● If the conditions are satisfied, then only output is obtained.
  • 4. 4 Why is looping used? ● If we want to print ‘HI’ 100 times it is not a willing work to implement ‘printf’ command 100 times. ● There are more chances to make mistake. ● If any error is found, it is very boring job to search for it in 100 printf commands executed. ● Thus to save time and mistake looping is used.
  • 5. 5 Types of Loop Statements in C ● Loop provides a way to repeat command and control how many times it is repeated. ● Types of loop: 1. For 2. While 3. Do...while
  • 7. 7 For Loop ● For loop is called entry control loop as it checks the condition while entering the loop. ● The loop is repeated till the given condition is satisfied, once the condition is not satisfied the loop is terminated and program comes to next statement.
  • 9. 9 While Loop ● While loop is also called entry control loop as it checks the condition during entering the loop. ● Once the condition is satisfied, loop is executed and the printf statement in it is executed and incr/decr is done for next condition checking.
  • 11. 11 Do.....while Loop ● Do...while loop is also known as exit control loop as the condition is checked during exit of loop. ● In false condition also the output statement is printed atleast once.
  • 12. 12 Nesting of Loop Statements ● Loop within a loop is called Nested loop and this action is called Nesting of loop statements. ● One loop is kept inside the body of first loop. ● Number of nested loops are also possible.
  • 14. 14 Example of Nested loop ● The nesting of loop is executed when condition of first loop is true. ● The outer loop takes control of number of complete repetitions of inner loop. ● The most common nested loop is ‘for’ loop.
  • 15. 15 Conclusion ● Looping saves time. ● It is easy to execute. ● It decreases the possibilities of mistakes while programming. ● Nesting of loop allows us to write more complex programs.