SlideShare a Scribd company logo
2
Most read
9
Most read
10
Most read
The Loops
• In computer programming, a loop is a
sequence of instructions that is continually
repeated until a certain condition is reached.
• Programming languages provide various
control structures that allow for more
complicated execution paths.
• Loop control statements change execution
from its normal sequence. When execution
leaves a scope, all automatic objects that were
created in that scope are destroyed.
• A loop statement allows us to execute a
statement or group of statements multiple
times and following is the general form of a
loop statement in most of the programming
languages.
DIFFERENT TYPES OF
LOOP
Loop Type Description
While loop Repeats a statement or group of statements
while a given condition is true. It tests the
condition before executing the loop body.
For loop Execute a sequence of statements multiple
times and abbreviates the code that
manages the loop variable.
Do……While loop Like a while statement, except that it tests
the condition at the end of the loop body
Nested loop You can use one or more loop inside any
another while, for or do..while loop.
FOR LOOP
 SYNTAX :
 The syntax of a for loop in C programming
language is:
 In computer science a for loop is a programming
language statement which allows code to be
repeatedly executed.
FLOWCHART
 Ex.1. A program to store 10 real nos.
using for loop.
OUTPUT
SYNTAX:
 The syntax of a while loop in C programming
language is:
 A while loop statement in C programming
language repeatedly executes a target statement
as long as a given condition is true.
FLOWCHART OF WHILE LOOP
 Ex.2. A PROGRAM USING WHILE
LOOP.
OUTPUT
DO…..WHILE loop
 Unlike for and while loops, which test the loop
condition at the top of the loop,
the do...while loop in C programming
language checks its condition at the bottom of
the loop.
 A do...while loop is similar to a while loop,
except that a do...while loop is guaranteed to
execute at least one time.
 Ex.3. A program using DO…WHILE loop
with its OUTPUT.
Nested loops
The syntax for a nested for loop statement in
C is as follows:
 The syntax for nested while and do….while
loop:
do
{
statement(s);
do
{
statement(s);
}
while(condition);
}
while( condition );
while( condition )
{
while( condition )
{
statement(s);
}
statement(s);
}
Nested loops
 Ex.4. A program using nested for
loop.
OUTPUT
KRISHMA PAREKH
2nd year C.E.

More Related Content

What's hot (20)

PPTX
While , For , Do-While Loop
Abhishek Choksi
 
PPTX
Control statements in c
Sathish Narayanan
 
PPTX
Loop(for, while, do while) condition Presentation
Badrul Alam
 
PPTX
Loops in C Programming Language
Mahantesh Devoor
 
PPTX
C if else
Ritwik Das
 
PDF
10. switch case
Way2itech
 
PPTX
Decision Making Statement in C ppt
MANJUTRIPATHI7
 
PPTX
Presentation on C Switch Case Statements
Dipesh Panday
 
PPTX
Union in C programming
Kamal Acharya
 
PPTX
Inheritance in java
RahulAnanda1
 
PPTX
Conditional statement c++
amber chaudary
 
PPT
Variables in C Programming
programming9
 
PPTX
Preprocessor directives in c language
tanmaymodi4
 
PPT
While loop
Feras_83
 
PPTX
Loops in c programming
CHANDAN KUMAR
 
PPTX
Pointers in C Programming
Jasleen Kaur (Chandigarh University)
 
PPTX
Storage class in C Language
Nitesh Kumar Pandey
 
PPTX
Loops Basics
Mushiii
 
PDF
C++ Tokens
Amrit Kaur
 
While , For , Do-While Loop
Abhishek Choksi
 
Control statements in c
Sathish Narayanan
 
Loop(for, while, do while) condition Presentation
Badrul Alam
 
Loops in C Programming Language
Mahantesh Devoor
 
C if else
Ritwik Das
 
10. switch case
Way2itech
 
Decision Making Statement in C ppt
MANJUTRIPATHI7
 
Presentation on C Switch Case Statements
Dipesh Panday
 
Union in C programming
Kamal Acharya
 
Inheritance in java
RahulAnanda1
 
Conditional statement c++
amber chaudary
 
Variables in C Programming
programming9
 
Preprocessor directives in c language
tanmaymodi4
 
While loop
Feras_83
 
Loops in c programming
CHANDAN KUMAR
 
Pointers in C Programming
Jasleen Kaur (Chandigarh University)
 
Storage class in C Language
Nitesh Kumar Pandey
 
Loops Basics
Mushiii
 
C++ Tokens
Amrit Kaur
 

Similar to The Loops (20)

PPTX
C loops
sunilchute1
 
PPTX
Loop structures
tazeem sana
 
PPTX
Fundamentals of programming
Kaycee Parcon
 
PPTX
Loop in C Properties & Applications
Emroz Sardar
 
PPTX
C Language Presentation.pptx
PradeepKumar206701
 
PPTX
DECISION MAKING.pptx
Ayshwarya Baburam
 
PPTX
Loops IN COMPUTER SCIENCE STANDARD 11 BY KR
Krishna Raj
 
PPTX
Final project powerpoint template (fndprg) (1)
jewelyngrace
 
PPTX
Cse lecture-7-c loop
FarshidKhan
 
PDF
Cpp loop types
Rj Baculo
 
PPTX
python.pptx
Poornima116356
 
PPTX
2nd year computer science chapter 12 notes
muhammadFaheem656405
 
PPTX
Loop-1.pptx
MuhammadArsalan896347
 
PPTX
Looping and switch cases
MeoRamos
 
PDF
While and For Loops
باسل قدح
 
PPTX
Presentation1
kartik sopran
 
C loops
sunilchute1
 
Loop structures
tazeem sana
 
Fundamentals of programming
Kaycee Parcon
 
Loop in C Properties & Applications
Emroz Sardar
 
C Language Presentation.pptx
PradeepKumar206701
 
DECISION MAKING.pptx
Ayshwarya Baburam
 
Loops IN COMPUTER SCIENCE STANDARD 11 BY KR
Krishna Raj
 
Final project powerpoint template (fndprg) (1)
jewelyngrace
 
Cse lecture-7-c loop
FarshidKhan
 
Cpp loop types
Rj Baculo
 
python.pptx
Poornima116356
 
2nd year computer science chapter 12 notes
muhammadFaheem656405
 
Looping and switch cases
MeoRamos
 
While and For Loops
باسل قدح
 
Presentation1
kartik sopran
 
Ad

More from Krishma Parekh (6)

PPTX
Longest Common Subsequence
Krishma Parekh
 
PPTX
J - K & MASTERSLAVE FLIPFLOPS
Krishma Parekh
 
PPTX
Sunlight controlled lamp!!!
Krishma Parekh
 
PPTX
Tourism
Krishma Parekh
 
PPTX
Trigo. in daily life
Krishma Parekh
 
PPTX
An Untiring Odyssey
Krishma Parekh
 
Longest Common Subsequence
Krishma Parekh
 
J - K & MASTERSLAVE FLIPFLOPS
Krishma Parekh
 
Sunlight controlled lamp!!!
Krishma Parekh
 
Trigo. in daily life
Krishma Parekh
 
An Untiring Odyssey
Krishma Parekh
 
Ad

Recently uploaded (20)

PPTX
ENGLISH 8 WEEK 3 Q1 - Analyzing the linguistic, historical, andor biographica...
OliverOllet
 
PDF
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
PPTX
Electrophysiology_of_Heart. Electrophysiology studies in Cardiovascular syste...
Rajshri Ghogare
 
PDF
Module 2: Public Health History [Tutorial Slides]
JonathanHallett4
 
PPTX
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
PDF
John Keats introduction and list of his important works
vatsalacpr
 
DOCX
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
PPTX
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
PDF
Virat Kohli- the Pride of Indian cricket
kushpar147
 
PPTX
Artificial Intelligence in Gastroentrology: Advancements and Future Presprec...
AyanHossain
 
PPTX
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
PPTX
Applied-Statistics-1.pptx hardiba zalaaa
hardizala899
 
PPTX
Introduction to Probability(basic) .pptx
purohitanuj034
 
PPTX
Virus sequence retrieval from NCBI database
yamunaK13
 
PPTX
Basics and rules of probability with real-life uses
ravatkaran694
 
PPTX
TOP 10 AI TOOLS YOU MUST LEARN TO SURVIVE IN 2025 AND ABOVE
digilearnings.com
 
PDF
TOP 10 AI TOOLS YOU MUST LEARN TO SURVIVE IN 2025 AND ABOVE
digilearnings.com
 
PPTX
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
PPTX
K-Circle-Weekly-Quiz12121212-May2025.pptx
Pankaj Rodey
 
ENGLISH 8 WEEK 3 Q1 - Analyzing the linguistic, historical, andor biographica...
OliverOllet
 
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
Electrophysiology_of_Heart. Electrophysiology studies in Cardiovascular syste...
Rajshri Ghogare
 
Module 2: Public Health History [Tutorial Slides]
JonathanHallett4
 
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
John Keats introduction and list of his important works
vatsalacpr
 
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
Virat Kohli- the Pride of Indian cricket
kushpar147
 
Artificial Intelligence in Gastroentrology: Advancements and Future Presprec...
AyanHossain
 
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
Applied-Statistics-1.pptx hardiba zalaaa
hardizala899
 
Introduction to Probability(basic) .pptx
purohitanuj034
 
Virus sequence retrieval from NCBI database
yamunaK13
 
Basics and rules of probability with real-life uses
ravatkaran694
 
TOP 10 AI TOOLS YOU MUST LEARN TO SURVIVE IN 2025 AND ABOVE
digilearnings.com
 
TOP 10 AI TOOLS YOU MUST LEARN TO SURVIVE IN 2025 AND ABOVE
digilearnings.com
 
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
K-Circle-Weekly-Quiz12121212-May2025.pptx
Pankaj Rodey
 

The Loops

  • 2. • In computer programming, a loop is a sequence of instructions that is continually repeated until a certain condition is reached. • Programming languages provide various control structures that allow for more complicated execution paths. • Loop control statements change execution from its normal sequence. When execution leaves a scope, all automatic objects that were created in that scope are destroyed.
  • 3. • A loop statement allows us to execute a statement or group of statements multiple times and following is the general form of a loop statement in most of the programming languages.
  • 4. DIFFERENT TYPES OF LOOP Loop Type Description While loop Repeats a statement or group of statements while a given condition is true. It tests the condition before executing the loop body. For loop Execute a sequence of statements multiple times and abbreviates the code that manages the loop variable. Do……While loop Like a while statement, except that it tests the condition at the end of the loop body Nested loop You can use one or more loop inside any another while, for or do..while loop.
  • 5. FOR LOOP  SYNTAX :  The syntax of a for loop in C programming language is:  In computer science a for loop is a programming language statement which allows code to be repeatedly executed.
  • 7.  Ex.1. A program to store 10 real nos. using for loop.
  • 9. SYNTAX:  The syntax of a while loop in C programming language is:  A while loop statement in C programming language repeatedly executes a target statement as long as a given condition is true.
  • 11.  Ex.2. A PROGRAM USING WHILE LOOP.
  • 13. DO…..WHILE loop  Unlike for and while loops, which test the loop condition at the top of the loop, the do...while loop in C programming language checks its condition at the bottom of the loop.  A do...while loop is similar to a while loop, except that a do...while loop is guaranteed to execute at least one time.
  • 14.  Ex.3. A program using DO…WHILE loop with its OUTPUT.
  • 15. Nested loops The syntax for a nested for loop statement in C is as follows:
  • 16.  The syntax for nested while and do….while loop: do { statement(s); do { statement(s); } while(condition); } while( condition ); while( condition ) { while( condition ) { statement(s); } statement(s); } Nested loops
  • 17.  Ex.4. A program using nested for loop.