SlideShare a Scribd company logo
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

PPTX
The Loops
PPTX
Loops in c programming
PPTX
types of loops and what is loop
PPTX
Forloop
PPTX
Do...while loop structure

What's hot (20)

PPTX
While , For , Do-While Loop
PPTX
Iteration Statement in C++
PPTX
Looping and Switchcase BDCR
PPTX
Looping statement
PPTX
Loops c++
PPTX
Loops in C Programming Language
PPT
While loop
PPT
Iteration
PPTX
Loops IN COMPUTER SCIENCE STANDARD 11 BY KR
PPTX
3.looping(iteration statements)
PPTX
Nested loop in C language
PPT
Looping in c++
PPTX
Presentation on nesting of loops
PPTX
Loops Basics
PPTX
Loops in c language
PPT
Looping in c++
PPTX
Vb.net (loop structure)
PPTX
C++ loop
PPT
Different loops in C
While , For , Do-While Loop
Iteration Statement in C++
Looping and Switchcase BDCR
Looping statement
Loops c++
Loops in C Programming Language
While loop
Iteration
Loops IN COMPUTER SCIENCE STANDARD 11 BY KR
3.looping(iteration statements)
Nested loop in C language
Looping in c++
Presentation on nesting of loops
Loops Basics
Loops in c language
Looping in c++
Vb.net (loop structure)
C++ loop
Different loops in C
Ad

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

DOCX
loops and iteration.docx
PPTX
Object oriented programming18 control structures looping
PDF
Loops in C Programming | for Loop | do-while Loop | while Loop | Nested Loop
PPTX
Control Statement IN C.pptx
PPTX
PPTX
C loops
PDF
Loop and while Loop
PPTX
Loops in c
PPTX
PDF
Unit II chapter 4 Loops in C
PDF
Chapter 12 Computer Science ( ICS 12).pdf
PPTX
Programming in python - Week 4
PDF
While-For-loop in python used in college
PPTX
While_for_loop presententationin first year students
PPT
Ch3 repetition
PPTX
C Programming: Looping Statements in C Pgm
PPT
Chapter 5 Looping
PPTX
Loop (Computer programming and utilization)
PPTX
Going loopy - Introduction to Loops.pptx
PDF
[ITP - Lecture 11] Loops in C/C++
loops and iteration.docx
Object oriented programming18 control structures looping
Loops in C Programming | for Loop | do-while Loop | while Loop | Nested Loop
Control Statement IN C.pptx
C loops
Loop and while Loop
Loops in c
Unit II chapter 4 Loops in C
Chapter 12 Computer Science ( ICS 12).pdf
Programming in python - Week 4
While-For-loop in python used in college
While_for_loop presententationin first year students
Ch3 repetition
C Programming: Looping Statements in C Pgm
Chapter 5 Looping
Loop (Computer programming and utilization)
Going loopy - Introduction to Loops.pptx
[ITP - Lecture 11] Loops in C/C++
Ad

More from harsh kothari (11)

PPTX
Instructuion set of 8085
PPTX
Java(Polymorphism)
PPTX
Fractional Knapsack Problem
PPTX
stirling method maths
PPTX
170120107066 dbms
PPTX
170120107066 dielectric.ppt
PPTX
170120107066 chronemics.ppt
PPTX
170120107066 power series.ppt
PPTX
170120107066 flowchart.ppt
PPTX
control circuit
Instructuion set of 8085
Java(Polymorphism)
Fractional Knapsack Problem
stirling method maths
170120107066 dbms
170120107066 dielectric.ppt
170120107066 chronemics.ppt
170120107066 power series.ppt
170120107066 flowchart.ppt
control circuit

Recently uploaded (20)

DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
Geodesy 1.pptx...............................................
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPT
Project quality management in manufacturing
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
additive manufacturing of ss316l using mig welding
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPT
Mechanical Engineering MATERIALS Selection
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
UNIT-1 - COAL BASED THERMAL POWER PLANTS
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
bas. eng. economics group 4 presentation 1.pptx
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Geodesy 1.pptx...............................................
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Project quality management in manufacturing
Operating System & Kernel Study Guide-1 - converted.pdf
OOP with Java - Java Introduction (Basics)
UNIT 4 Total Quality Management .pptx
CH1 Production IntroductoryConcepts.pptx
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
additive manufacturing of ss316l using mig welding
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
Mechanical Engineering MATERIALS Selection
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
CYBER-CRIMES AND SECURITY A guide to understanding
Embodied AI: Ushering in the Next Era of Intelligent Systems

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.