SlideShare una empresa de Scribd logo
1 de 16
PRESANTATION ON
“Looping control structure”
GUPTA HARSH
13ME030
Introduction of loop
• A loop is a programming structure that allows
an action to repeat until the program meets a
given condition.
• After each iteration of a loop, the loop checks
against a loop control expression to see if the
program met a the given condition. If it did,
the loop stops. If not, the loop moves on to
the next iteration.
CONTINUE…
• Loop: a control structure that repeats a group
of steps in a program
• C loop control statements
• Two types of control statement….. They are:-
Exit control loop and
Entry control loop
Exit Control loop
• In exit control loop, the
body is executed first and
then the condition is
checked.
• In exit control loop the
body is executed
at least once.
Entry Control loop
• In entry control loop,
the condition is checked
first and then body is
executed.
• In Entry control loop
the body is not
executed at all if the
condition is false.
Looping…
• ‘C’ language provides following looping
structures:-
1. WHILE
2. DO-WHILE
3. FOR
WHILE LOOP
– Of the three different loop structures offered in C, while-
loops are conceptually the simplest.
– Resembles if-statement, but does not have an else.
– Conceptually, keep executing the loop body again and
again till the condition is true.
– Loop terminates when the loop condition becomes false.
– Note that the truth of the loop condition is not checked
constantly between every statement in the loop body, but
only at the beginning of the loop, and then again between
the repetitions of the loop body
– Condition may be temporarily false during the loop, but
become true again before it is checked
DO-WHILE LOOP
– The second type of loop offered in C is the do-while.
– Clearly the least commonly used of the three: one famous
study of real world programs revealed that out of all loops
in them, only 1% are do-while.
– Do-while behaves exactly the same way as the while-loop,
but is guaranteed to execute its body at least once before
it starts looking at the loop condition.
– The possibility of executing the loop body zero times
does not exist, even if the condition is initially false
– do-while is most useful in situations where testing
the condition simply does not make any sense until
the loop body has been executed once
FOR LOOP
– The third type of loop structure in C is suitable for
the common task of iterating through the values of
a range of integers, one value at the time.
– For example, go through the numbers from 1 to 100.
– The for-loop header defines this range, and the loop
body contains the statements you execute for each
value.
– To define an integer range, you need to define three
things: where it begins (1), where it ends (100), and
the step size between the consecutive values of the
range (1)
CONTINUE…
– It is not a coincidence that the header of a for-loop
consists of three parts, for the three things that
define a range.
– We can still use while like in countdown, but using a
for-loop makes it clear that we are going through a
range.
– It is not a coincidence that the header of a for-loop
consists of three parts, for the three things that
define a range.
– We can still use while like in countdown, but using a
for-loop makes it clear that we are going through a
range.
Flowchart of FOR LOOP
for( initializing list;condition; updation)
BREAK STATEMENT
• Remember the break keyword that we used
to stop a switch statement from executing
more than one statement?
• break can also be used to exit an infinite
loop
• But it is almost always best to use a well-
written while loop.
CONTINUE STATEMENT
– Continue is a statement similar to break, but
instead of jumping out of the loop altogether, it
jumps to the next round of the loop, skipping the
rest of the body
– Most commonly used to skip some of the values
inside the range for which the loop doesn't need
to do anything
Looping Control Structures Presentation

Más contenido relacionado

La actualidad más candente (20)

Types of loops in c language
Types of loops in c languageTypes of loops in c language
Types of loops in c language
 
Java loops
Java loopsJava loops
Java loops
 
Programming loop
Programming loopProgramming loop
Programming loop
 
Java input Scanner
Java input Scanner Java input Scanner
Java input Scanner
 
Chap 6(decision making-looping)
Chap 6(decision making-looping)Chap 6(decision making-looping)
Chap 6(decision making-looping)
 
Java Repetiotion Statements
Java Repetiotion StatementsJava Repetiotion Statements
Java Repetiotion Statements
 
Loops c++
Loops c++Loops c++
Loops c++
 
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
 
loops and iteration.docx
loops and iteration.docxloops and iteration.docx
loops and iteration.docx
 
Forloop
ForloopForloop
Forloop
 
While loops
While loopsWhile loops
While loops
 
The Loops
The LoopsThe Loops
The Loops
 
Decision making and looping
Decision making and loopingDecision making and looping
Decision making and looping
 
Loop (Computer programming and utilization)
Loop (Computer programming and utilization)Loop (Computer programming and utilization)
Loop (Computer programming and utilization)
 
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++
 
Presentation on Loop(C Language) by Dheemaan Daash
Presentation on Loop(C Language)  by Dheemaan DaashPresentation on Loop(C Language)  by Dheemaan Daash
Presentation on Loop(C Language) by Dheemaan Daash
 
Loops
LoopsLoops
Loops
 
Looping
LoopingLooping
Looping
 
Control structures in c++
Control structures in c++Control structures in c++
Control structures in c++
 

Similar a Looping Control Structures Presentation

Similar a Looping Control Structures Presentation (20)

Cse lecture-7-c loop
Cse lecture-7-c loopCse lecture-7-c loop
Cse lecture-7-c loop
 
Loop in C Properties & Applications
Loop in C Properties & ApplicationsLoop in C Properties & Applications
Loop in C Properties & Applications
 
C language 2
C language 2C language 2
C language 2
 
Cpp loop types
Cpp loop typesCpp loop types
Cpp loop types
 
Loop
LoopLoop
Loop
 
Loops
LoopsLoops
Loops
 
C language (Part 2)
C language (Part 2)C language (Part 2)
C language (Part 2)
 
Loop structures
Loop structuresLoop structures
Loop structures
 
Chapter 9 - Loops in C++
Chapter 9 - Loops in C++Chapter 9 - Loops in C++
Chapter 9 - Loops in 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
 
Igdpd c21 loops
Igdpd c21 loopsIgdpd c21 loops
Igdpd c21 loops
 
Computer programming 2 Lesson 8
Computer programming 2  Lesson 8Computer programming 2  Lesson 8
Computer programming 2 Lesson 8
 
Control structures repetition
Control structures   repetitionControl structures   repetition
Control structures repetition
 
Loops In C++
Loops In C++Loops In C++
Loops In C++
 
whileloop-161225171903.pdf
whileloop-161225171903.pdfwhileloop-161225171903.pdf
whileloop-161225171903.pdf
 
While loop
While loopWhile loop
While loop
 
C Programming - Decision making, Looping
C  Programming - Decision making, LoopingC  Programming - Decision making, Looping
C Programming - Decision making, Looping
 
Loops in c programming
Loops in c programmingLoops in c programming
Loops in c programming
 
Loops in c++
Loops in c++Loops in c++
Loops in c++
 
Loops
LoopsLoops
Loops
 

Último

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 

Último (20)

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 

Looping Control Structures Presentation

  • 1. PRESANTATION ON “Looping control structure” GUPTA HARSH 13ME030
  • 2. Introduction of loop • A loop is a programming structure that allows an action to repeat until the program meets a given condition. • After each iteration of a loop, the loop checks against a loop control expression to see if the program met a the given condition. If it did, the loop stops. If not, the loop moves on to the next iteration.
  • 3. CONTINUE… • Loop: a control structure that repeats a group of steps in a program • C loop control statements • Two types of control statement….. They are:- Exit control loop and Entry control loop
  • 4. Exit Control loop • In exit control loop, the body is executed first and then the condition is checked. • In exit control loop the body is executed at least once.
  • 5. Entry Control loop • In entry control loop, the condition is checked first and then body is executed. • In Entry control loop the body is not executed at all if the condition is false.
  • 6. Looping… • ‘C’ language provides following looping structures:- 1. WHILE 2. DO-WHILE 3. FOR
  • 7. WHILE LOOP – Of the three different loop structures offered in C, while- loops are conceptually the simplest. – Resembles if-statement, but does not have an else. – Conceptually, keep executing the loop body again and again till the condition is true. – Loop terminates when the loop condition becomes false. – Note that the truth of the loop condition is not checked constantly between every statement in the loop body, but only at the beginning of the loop, and then again between the repetitions of the loop body – Condition may be temporarily false during the loop, but become true again before it is checked
  • 8.
  • 9. DO-WHILE LOOP – The second type of loop offered in C is the do-while. – Clearly the least commonly used of the three: one famous study of real world programs revealed that out of all loops in them, only 1% are do-while. – Do-while behaves exactly the same way as the while-loop, but is guaranteed to execute its body at least once before it starts looking at the loop condition. – The possibility of executing the loop body zero times does not exist, even if the condition is initially false – do-while is most useful in situations where testing the condition simply does not make any sense until the loop body has been executed once
  • 10.
  • 11. FOR LOOP – The third type of loop structure in C is suitable for the common task of iterating through the values of a range of integers, one value at the time. – For example, go through the numbers from 1 to 100. – The for-loop header defines this range, and the loop body contains the statements you execute for each value. – To define an integer range, you need to define three things: where it begins (1), where it ends (100), and the step size between the consecutive values of the range (1)
  • 12. CONTINUE… – It is not a coincidence that the header of a for-loop consists of three parts, for the three things that define a range. – We can still use while like in countdown, but using a for-loop makes it clear that we are going through a range. – It is not a coincidence that the header of a for-loop consists of three parts, for the three things that define a range. – We can still use while like in countdown, but using a for-loop makes it clear that we are going through a range.
  • 13. Flowchart of FOR LOOP for( initializing list;condition; updation)
  • 14. BREAK STATEMENT • Remember the break keyword that we used to stop a switch statement from executing more than one statement? • break can also be used to exit an infinite loop • But it is almost always best to use a well- written while loop.
  • 15. CONTINUE STATEMENT – Continue is a statement similar to break, but instead of jumping out of the loop altogether, it jumps to the next round of the loop, skipping the rest of the body – Most commonly used to skip some of the values inside the range for which the loop doesn't need to do anything