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
Loops in C Programming Language
Mahantesh Devoor
 
PPTX
Loops in c programming
CHANDAN KUMAR
 
PPTX
Forloop
Dipen Vasoya
 
PPT
Looping statements in Java
Jin Castor
 
PPTX
While , For , Do-While Loop
Abhishek Choksi
 
PDF
10. switch case
Way2itech
 
PPTX
Decision making statements in C programming
Rabin BK
 
PPT
Modular programming
Mohanlal Sukhadia University (MLSU)
 
PPT
While loop
Feras_83
 
PPTX
Structure in C
Kamal Acharya
 
PPTX
Control structures in java
VINOTH R
 
PPTX
types of loops and what is loop
waheed dogar
 
PPTX
classes and objects in C++
HalaiHansaika
 
PPTX
Strings in c++
Neeru Mittal
 
PPSX
INTRODUCTION TO C PROGRAMMING
Abhishek Dwivedi
 
PPTX
Presentation on C Switch Case Statements
Dipesh Panday
 
PPTX
C++ string
Dheenadayalan18
 
PPT
Kleene's theorem
Mobeen Mustafa
 
PPTX
control statements in python.pptx
Anshu Varma
 
PPTX
Polish Notation In Data Structure
Meghaj Mallick
 
Loops in C Programming Language
Mahantesh Devoor
 
Loops in c programming
CHANDAN KUMAR
 
Forloop
Dipen Vasoya
 
Looping statements in Java
Jin Castor
 
While , For , Do-While Loop
Abhishek Choksi
 
10. switch case
Way2itech
 
Decision making statements in C programming
Rabin BK
 
While loop
Feras_83
 
Structure in C
Kamal Acharya
 
Control structures in java
VINOTH R
 
types of loops and what is loop
waheed dogar
 
classes and objects in C++
HalaiHansaika
 
Strings in c++
Neeru Mittal
 
INTRODUCTION TO C PROGRAMMING
Abhishek Dwivedi
 
Presentation on C Switch Case Statements
Dipesh Panday
 
C++ string
Dheenadayalan18
 
Kleene's theorem
Mobeen Mustafa
 
control statements in python.pptx
Anshu Varma
 
Polish Notation In Data Structure
Meghaj Mallick
 

Similar to The Loops (20)

PPTX
Cse lecture-7-c loop
FarshidKhan
 
PPTX
Loop (Computer programming and utilization)
Digvijaysinh Gohil
 
PDF
loops in C ppt.pdf
DrSamsonChepuri1
 
PPTX
Loop structures
tazeem sana
 
PPTX
Loop in C Properties & Applications
Emroz Sardar
 
DOCX
loops and iteration.docx
JavvajiVenkat
 
PPT
170120107074 looping statements and nesting of loop statements
harsh kothari
 
PPTX
C Programming: Looping Statements in C Pgm
Navya Francis
 
PDF
Repetition, Basic loop structures, Loop programming techniques
Jason J Pulikkottil
 
PDF
LOOP STATEMENTS AND TYPES OF LOOP IN C LANGUAGE BY RIZWAN
MD RIZWAN MOLLA
 
PDF
Looping in c language
Infinity Tech Solutions
 
PDF
Loop and while Loop
JayBhavsar68
 
PPTX
C Programming Language Part 6
Rumman Ansari
 
PDF
Chapter 3 - Flow of Control Part II.pdf
KirubelWondwoson1
 
PPT
Week2 ch4 part1edited 2020
Osama Ghandour Geris
 
PPT
Week2 ch4 part1edited 2020
Osama Ghandour Geris
 
PPTX
Looping (Computer programming and utilization)
Digvijaysinh Gohil
 
PDF
cpu.pdf
RAJCHATTERJEE24
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PPT
Different types of loops-Prasad.ppt
DxTechGaming
 
Cse lecture-7-c loop
FarshidKhan
 
Loop (Computer programming and utilization)
Digvijaysinh Gohil
 
loops in C ppt.pdf
DrSamsonChepuri1
 
Loop structures
tazeem sana
 
Loop in C Properties & Applications
Emroz Sardar
 
loops and iteration.docx
JavvajiVenkat
 
170120107074 looping statements and nesting of loop statements
harsh kothari
 
C Programming: Looping Statements in C Pgm
Navya Francis
 
Repetition, Basic loop structures, Loop programming techniques
Jason J Pulikkottil
 
LOOP STATEMENTS AND TYPES OF LOOP IN C LANGUAGE BY RIZWAN
MD RIZWAN MOLLA
 
Looping in c language
Infinity Tech Solutions
 
Loop and while Loop
JayBhavsar68
 
C Programming Language Part 6
Rumman Ansari
 
Chapter 3 - Flow of Control Part II.pdf
KirubelWondwoson1
 
Week2 ch4 part1edited 2020
Osama Ghandour Geris
 
Week2 ch4 part1edited 2020
Osama Ghandour Geris
 
Looping (Computer programming and utilization)
Digvijaysinh Gohil
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Different types of loops-Prasad.ppt
DxTechGaming
 
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
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
PPTX
I INCLUDED THIS TOPIC IS INTELLIGENCE DEFINITION, MEANING, INDIVIDUAL DIFFERE...
parmarjuli1412
 
PPTX
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
PPTX
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
PPTX
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
PPT
DRUGS USED IN THERAPY OF SHOCK, Shock Therapy, Treatment or management of shock
Rajshri Ghogare
 
PPTX
YSPH VMOC Special Report - Measles Outbreak Southwest US 7-20-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
DOCX
pgdei-UNIT -V Neurological Disorders & developmental disabilities
JELLA VISHNU DURGA PRASAD
 
PPTX
K-Circle-Weekly-Quiz12121212-May2025.pptx
Pankaj Rodey
 
PPTX
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
PPTX
Introduction to Probability(basic) .pptx
purohitanuj034
 
PPTX
The Future of Artificial Intelligence Opportunities and Risks Ahead
vaghelajayendra784
 
PDF
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
PPTX
Unlock the Power of Cursor AI: MuleSoft Integrations
Veera Pallapu
 
PDF
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
DOCX
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
PPTX
Applied-Statistics-1.pptx hardiba zalaaa
hardizala899
 
PPTX
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
PPTX
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
I INCLUDED THIS TOPIC IS INTELLIGENCE DEFINITION, MEANING, INDIVIDUAL DIFFERE...
parmarjuli1412
 
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
DRUGS USED IN THERAPY OF SHOCK, Shock Therapy, Treatment or management of shock
Rajshri Ghogare
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 7-20-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
pgdei-UNIT -V Neurological Disorders & developmental disabilities
JELLA VISHNU DURGA PRASAD
 
K-Circle-Weekly-Quiz12121212-May2025.pptx
Pankaj Rodey
 
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
Introduction to Probability(basic) .pptx
purohitanuj034
 
The Future of Artificial Intelligence Opportunities and Risks Ahead
vaghelajayendra784
 
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
Unlock the Power of Cursor AI: MuleSoft Integrations
Veera Pallapu
 
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
Applied-Statistics-1.pptx hardiba zalaaa
hardizala899
 
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 

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.