SlideShare a Scribd company logo
4
Most read
5
Most read
13
Most read
Looping (Computer programming and utilization)
Content.
• [1] Looping statement.
• [2] WHILE LOOP.
• [3] DO WHILE LOOP.
• [4] FOR LOOP.
LOOPING
• Looping is the process of repeatedly executing
a block of statements until some conditions
for the termination of the loop are satisfied.
• Two types of loop structure are:
• 1) pretest
• 2) posttest
Pretest v/s posttest
Pretest
• Condition is tested before
each iteration to check if
loops should occur.
• eg: For & while loop.
Posttest
• Condition is tested after
each iteration to check if
loops should continue (at
least a single iteration
occurs).
• Eg: do while loop.
The while statement
• It is an entry-controlled loop statement. The
test condition is evaluated and if it is true, the
body of the loop is executed. After execution
of the body, the condition is again evaluated
and if it is true, the body of the loop is
executed again. This process continuous until
the test condition becomes false and the
control is transferred out of the loop.
Syntax:
while(test expression)
{
Body of the loop
}
statement-x;
Example:
While(i=0; i<3; i++)
printf(“hellon”);
output:
Hello
Hello
Hello
The do_while statement
• It is an exit controlled loop statement. The body of
the loop of do statement is compulsorily executed
for the first time. After executing once., at the end of
the loop, the test condition in the while statement is
evaluated. If the condition is true, the body of the
loop is executed again and this process continuous
until the condition becomes false, the loop execution
is terminated and the control goes to the statement
that appears after the while statement.
Syntax:
Do
{
body of the loop
}
While (test condition);
Statement-x;
Example:
Do
{
printf(“Hellon”);
}
While(i<3)
Output:
Hello
Hello
Hello
The for statement:
• It is also an entry-controlled loop.
• All for loops are executed in following
sequence.
• 1] it executes initialization statements
• 2] it check the test condition if true than go to
step:3 other wise step 4.
• 3] execute body of loop and go to step 2 after
increment or decrement
• 4] other statement of the program.
Syntax:
For(initialization; test condition; increment)
{
body of the loop
}
•Different ways of using for loop:
•More than one variable can be initialized in the for loop.
For(p=1, n=0; n<4; ++n)
•The increment section may contain more than one part.
For(p=1,n=0; n<4; ++n, ++p)
•You can either do increment or decrement.
For(n=4; n>0; -n)
•You can also omit one or more sections in the for loop.
For( ; n<4; )
Example:
For(i=0; i<3; i+)
Printf(“Hellon”);
Output:
Hello
Hello
Hello
Looping (Computer programming and utilization)
Ad

Recommended

Looping statements in Java
Looping statements in Java
Jin Castor
 
NFA Converted to DFA , Minimization of DFA , Transition Diagram
NFA Converted to DFA , Minimization of DFA , Transition Diagram
Abdullah Jan
 
Loop(for, while, do while) condition Presentation
Loop(for, while, do while) condition Presentation
Badrul Alam
 
While loop
While loop
Feras_83
 
types of loops and what is loop
types of loops and what is loop
waheed dogar
 
Push down automata
Push down automata
Ratnakar Mikkili
 
Loops c++
Loops c++
Shivani Singh
 
Java basics and java variables
Java basics and java variables
Pushpendra Tyagi
 
Nested loops
Nested loops
Neeru Mittal
 
Repetition Structure
Repetition Structure
PRN USM
 
Operators in java
Operators in java
Then Murugeshwari
 
The Loops
The Loops
Krishma Parekh
 
Loops in c language
Loops in c language
Tanmay Modi
 
Control structures in C++ Programming Language
Control structures in C++ Programming Language
Ahmad Idrees
 
C presentation
C presentation
APSMIND TECHNOLOGY PVT LTD.
 
itft-Decision making and branching in java
itft-Decision making and branching in java
Atul Sehdev
 
Top down and botttom up Parsing
Top down and botttom up Parsing
Gerwin Ocsena
 
Control Structures
Control Structures
Ghaffar Khan
 
Lexical Analysis - Compiler design
Lexical Analysis - Compiler design
Aman Sharma
 
Lex and Yacc ppt
Lex and Yacc ppt
pssraikar
 
Java if else condition - powerpoint persentation
Java if else condition - powerpoint persentation
Maneesha Caldera
 
Control Flow Statements
Control Flow Statements
Tarun Sharma
 
Input-Buffering
Input-Buffering
Dattatray Gandhmal
 
Specification-of-tokens
Specification-of-tokens
Dattatray Gandhmal
 
Control structures in java
Control structures in java
VINOTH R
 
Control and conditional statements
Control and conditional statements
rajshreemuthiah
 
Loops in c++ programming language
Loops in c++ programming language
MUHAMMAD ALI student of IT at karakoram International university gilgit baltistan
 
Control Flow Graphs
Control Flow Graphs
daimk2020
 
Loop (Computer programming and utilization)
Loop (Computer programming and utilization)
Digvijaysinh Gohil
 
Unit II chapter 4 Loops in C
Unit II chapter 4 Loops in C
Sowmya Jyothi
 

More Related Content

What's hot (20)

Nested loops
Nested loops
Neeru Mittal
 
Repetition Structure
Repetition Structure
PRN USM
 
Operators in java
Operators in java
Then Murugeshwari
 
The Loops
The Loops
Krishma Parekh
 
Loops in c language
Loops in c language
Tanmay Modi
 
Control structures in C++ Programming Language
Control structures in C++ Programming Language
Ahmad Idrees
 
C presentation
C presentation
APSMIND TECHNOLOGY PVT LTD.
 
itft-Decision making and branching in java
itft-Decision making and branching in java
Atul Sehdev
 
Top down and botttom up Parsing
Top down and botttom up Parsing
Gerwin Ocsena
 
Control Structures
Control Structures
Ghaffar Khan
 
Lexical Analysis - Compiler design
Lexical Analysis - Compiler design
Aman Sharma
 
Lex and Yacc ppt
Lex and Yacc ppt
pssraikar
 
Java if else condition - powerpoint persentation
Java if else condition - powerpoint persentation
Maneesha Caldera
 
Control Flow Statements
Control Flow Statements
Tarun Sharma
 
Input-Buffering
Input-Buffering
Dattatray Gandhmal
 
Specification-of-tokens
Specification-of-tokens
Dattatray Gandhmal
 
Control structures in java
Control structures in java
VINOTH R
 
Control and conditional statements
Control and conditional statements
rajshreemuthiah
 
Loops in c++ programming language
Loops in c++ programming language
MUHAMMAD ALI student of IT at karakoram International university gilgit baltistan
 
Control Flow Graphs
Control Flow Graphs
daimk2020
 

Similar to Looping (Computer programming and utilization) (20)

Loop (Computer programming and utilization)
Loop (Computer programming and utilization)
Digvijaysinh Gohil
 
Unit II chapter 4 Loops in C
Unit II chapter 4 Loops in C
Sowmya Jyothi
 
Loop
Loop
MdEmonRana
 
Java Repetiotion Statements
Java Repetiotion Statements
Huda Alameen
 
Loops In C++
Loops In C++
Banasthali Vidyapith
 
presentation on powerpoint template.pptx
presentation on powerpoint template.pptx
farantouqeer8
 
While , For , Do-While Loop
While , For , Do-While Loop
Abhishek Choksi
 
cpu.pdf
cpu.pdf
RAJCHATTERJEE24
 
Loops in Cjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj.pptx
Loops in Cjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj.pptx
tanaykapse999
 
whileloop-161225171903.pdf
whileloop-161225171903.pdf
BasirKhan21
 
Lecture on Loop while loop for loop + program
Lecture on Loop while loop for loop + program
RahulKumar812056
 
control-statements....ppt - definition
control-statements....ppt - definition
Papitha7
 
Looping statements
Looping statements
AbhishekMondal42
 
Programming loop
Programming loop
University of Potsdam
 
Decision making and looping
Decision making and looping
Hossain Md Shakhawat
 
Chapter 9 - Loops in C++
Chapter 9 - Loops in C++
Deepak Singh
 
C Programming: Looping Statements in C Pgm
C Programming: Looping Statements in C Pgm
Navya Francis
 
Presentation on Loop(C Language) by Dheemaan Daash
Presentation on Loop(C Language) by Dheemaan Daash
Dheemaan Daash
 
dizital pods session 5-loops.pptx
dizital pods session 5-loops.pptx
VijayKumarLokanadam
 
Control Statement IN C.pptx
Control Statement IN C.pptx
sujatha629799
 
Loop (Computer programming and utilization)
Loop (Computer programming and utilization)
Digvijaysinh Gohil
 
Unit II chapter 4 Loops in C
Unit II chapter 4 Loops in C
Sowmya Jyothi
 
Java Repetiotion Statements
Java Repetiotion Statements
Huda Alameen
 
presentation on powerpoint template.pptx
presentation on powerpoint template.pptx
farantouqeer8
 
While , For , Do-While Loop
While , For , Do-While Loop
Abhishek Choksi
 
Loops in Cjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj.pptx
Loops in Cjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj.pptx
tanaykapse999
 
whileloop-161225171903.pdf
whileloop-161225171903.pdf
BasirKhan21
 
Lecture on Loop while loop for loop + program
Lecture on Loop while loop for loop + program
RahulKumar812056
 
control-statements....ppt - definition
control-statements....ppt - definition
Papitha7
 
Chapter 9 - Loops in C++
Chapter 9 - Loops in C++
Deepak Singh
 
C Programming: Looping Statements in C Pgm
C Programming: Looping Statements in C Pgm
Navya Francis
 
Presentation on Loop(C Language) by Dheemaan Daash
Presentation on Loop(C Language) by Dheemaan Daash
Dheemaan Daash
 
dizital pods session 5-loops.pptx
dizital pods session 5-loops.pptx
VijayKumarLokanadam
 
Control Statement IN C.pptx
Control Statement IN C.pptx
sujatha629799
 
Ad

More from Digvijaysinh Gohil (20)

Hydraulic cranes
Hydraulic cranes
Digvijaysinh Gohil
 
Hydraulic braking systems
Hydraulic braking systems
Digvijaysinh Gohil
 
Human resources management
Human resources management
Digvijaysinh Gohil
 
Traits of a good listner (Communication Skills)
Traits of a good listner (Communication Skills)
Digvijaysinh Gohil
 
Techniques of reading (Communication Skills)
Techniques of reading (Communication Skills)
Digvijaysinh Gohil
 
Proxemics (Communication Skills)
Proxemics (Communication Skills)
Digvijaysinh Gohil
 
Proxemics (2) (Communication Skills)
Proxemics (2) (Communication Skills)
Digvijaysinh Gohil
 
Paralinguistic (Communication Skills)
Paralinguistic (Communication Skills)
Digvijaysinh Gohil
 
Paralinguistic (2) (Communication Skills)
Paralinguistic (2) (Communication Skills)
Digvijaysinh Gohil
 
Paralinguistic (1) (Communication Skills)
Paralinguistic (1) (Communication Skills)
Digvijaysinh Gohil
 
Organizing a contents &amp; preparing an outline
Organizing a contents &amp; preparing an outline
Digvijaysinh Gohil
 
Organizing a contents &amp; preparing an outline (2)
Organizing a contents &amp; preparing an outline (2)
Digvijaysinh Gohil
 
Kinesics (Communication Skills)
Kinesics (Communication Skills)
Digvijaysinh Gohil
 
Kinesics (3) (Communication Skills)
Kinesics (3) (Communication Skills)
Digvijaysinh Gohil
 
Kinesics (2) (Communication Skills)
Kinesics (2) (Communication Skills)
Digvijaysinh Gohil
 
Introduction to communication (Communication Skills)
Introduction to communication (Communication Skills)
Digvijaysinh Gohil
 
Email etiquette (Communication Skills)
Email etiquette (Communication Skills)
Digvijaysinh Gohil
 
Welded joints (machine design & industrial drafting )
Welded joints (machine design & industrial drafting )
Digvijaysinh Gohil
 
Types of stresses and theories of failure (machine design & industrial drafti...
Types of stresses and theories of failure (machine design & industrial drafti...
Digvijaysinh Gohil
 
Treaded joint (machine design & industrial drafting )
Treaded joint (machine design & industrial drafting )
Digvijaysinh Gohil
 
Traits of a good listner (Communication Skills)
Traits of a good listner (Communication Skills)
Digvijaysinh Gohil
 
Techniques of reading (Communication Skills)
Techniques of reading (Communication Skills)
Digvijaysinh Gohil
 
Proxemics (Communication Skills)
Proxemics (Communication Skills)
Digvijaysinh Gohil
 
Proxemics (2) (Communication Skills)
Proxemics (2) (Communication Skills)
Digvijaysinh Gohil
 
Paralinguistic (Communication Skills)
Paralinguistic (Communication Skills)
Digvijaysinh Gohil
 
Paralinguistic (2) (Communication Skills)
Paralinguistic (2) (Communication Skills)
Digvijaysinh Gohil
 
Paralinguistic (1) (Communication Skills)
Paralinguistic (1) (Communication Skills)
Digvijaysinh Gohil
 
Organizing a contents &amp; preparing an outline
Organizing a contents &amp; preparing an outline
Digvijaysinh Gohil
 
Organizing a contents &amp; preparing an outline (2)
Organizing a contents &amp; preparing an outline (2)
Digvijaysinh Gohil
 
Kinesics (Communication Skills)
Kinesics (Communication Skills)
Digvijaysinh Gohil
 
Kinesics (3) (Communication Skills)
Kinesics (3) (Communication Skills)
Digvijaysinh Gohil
 
Kinesics (2) (Communication Skills)
Kinesics (2) (Communication Skills)
Digvijaysinh Gohil
 
Introduction to communication (Communication Skills)
Introduction to communication (Communication Skills)
Digvijaysinh Gohil
 
Email etiquette (Communication Skills)
Email etiquette (Communication Skills)
Digvijaysinh Gohil
 
Welded joints (machine design & industrial drafting )
Welded joints (machine design & industrial drafting )
Digvijaysinh Gohil
 
Types of stresses and theories of failure (machine design & industrial drafti...
Types of stresses and theories of failure (machine design & industrial drafti...
Digvijaysinh Gohil
 
Treaded joint (machine design & industrial drafting )
Treaded joint (machine design & industrial drafting )
Digvijaysinh Gohil
 
Ad

Recently uploaded (20)

System design handwritten notes guidance
System design handwritten notes guidance
Shabista Imam
 
LECTURE 7 COMPUTATIONS OF LEVELING DATA APRIL 2025.pptx
LECTURE 7 COMPUTATIONS OF LEVELING DATA APRIL 2025.pptx
rr22001247
 
FSE_LLM4SE1_A Tool for In-depth Analysis of Code Execution Reasoning of Large...
FSE_LLM4SE1_A Tool for In-depth Analysis of Code Execution Reasoning of Large...
cl144
 
Call For Papers - 17th International Conference on Wireless & Mobile Networks...
Call For Papers - 17th International Conference on Wireless & Mobile Networks...
hosseinihamid192023
 
AI_Presentation (1). Artificial intelligence
AI_Presentation (1). Artificial intelligence
RoselynKaur8thD34
 
Rapid Prototyping for XR: Lecture 4 - High Level Prototyping.
Rapid Prototyping for XR: Lecture 4 - High Level Prototyping.
Mark Billinghurst
 
Structured Programming with C++ :: Kjell Backman
Structured Programming with C++ :: Kjell Backman
Shabista Imam
 
Proposal for folders structure division in projects.pdf
Proposal for folders structure division in projects.pdf
Mohamed Ahmed
 
International Journal of Advanced Information Technology (IJAIT)
International Journal of Advanced Information Technology (IJAIT)
ijait
 
MATERIAL SCIENCE LECTURE NOTES FOR DIPLOMA STUDENTS
MATERIAL SCIENCE LECTURE NOTES FOR DIPLOMA STUDENTS
SAMEER VISHWAKARMA
 
تقرير عن التحليل الديناميكي لتدفق الهواء حول جناح.pdf
تقرير عن التحليل الديناميكي لتدفق الهواء حول جناح.pdf
محمد قصص فتوتة
 
Complete guidance book of Asp.Net Web API
Complete guidance book of Asp.Net Web API
Shabista Imam
 
May 2025: Top 10 Read Articles in Data Mining & Knowledge Management Process
May 2025: Top 10 Read Articles in Data Mining & Knowledge Management Process
IJDKP
 
Tally.ERP 9 at a Glance.book - Tally Solutions .pdf
Tally.ERP 9 at a Glance.book - Tally Solutions .pdf
Shabista Imam
 
20CE404-Soil Mechanics - Slide Share PPT
20CE404-Soil Mechanics - Slide Share PPT
saravananr808639
 
How to Un-Obsolete Your Legacy Keypad Design
How to Un-Obsolete Your Legacy Keypad Design
Epec Engineered Technologies
 
Introduction to Python Programming Language
Introduction to Python Programming Language
merlinjohnsy
 
Rapid Prototyping for XR: Lecture 6 - AI for Prototyping and Research Directi...
Rapid Prototyping for XR: Lecture 6 - AI for Prototyping and Research Directi...
Mark Billinghurst
 
دراسة حاله لقرية تقع في جنوب غرب السودان
دراسة حاله لقرية تقع في جنوب غرب السودان
محمد قصص فتوتة
 
DESIGN OF REINFORCED CONCRETE ELEMENTS S
DESIGN OF REINFORCED CONCRETE ELEMENTS S
prabhusp8
 
System design handwritten notes guidance
System design handwritten notes guidance
Shabista Imam
 
LECTURE 7 COMPUTATIONS OF LEVELING DATA APRIL 2025.pptx
LECTURE 7 COMPUTATIONS OF LEVELING DATA APRIL 2025.pptx
rr22001247
 
FSE_LLM4SE1_A Tool for In-depth Analysis of Code Execution Reasoning of Large...
FSE_LLM4SE1_A Tool for In-depth Analysis of Code Execution Reasoning of Large...
cl144
 
Call For Papers - 17th International Conference on Wireless & Mobile Networks...
Call For Papers - 17th International Conference on Wireless & Mobile Networks...
hosseinihamid192023
 
AI_Presentation (1). Artificial intelligence
AI_Presentation (1). Artificial intelligence
RoselynKaur8thD34
 
Rapid Prototyping for XR: Lecture 4 - High Level Prototyping.
Rapid Prototyping for XR: Lecture 4 - High Level Prototyping.
Mark Billinghurst
 
Structured Programming with C++ :: Kjell Backman
Structured Programming with C++ :: Kjell Backman
Shabista Imam
 
Proposal for folders structure division in projects.pdf
Proposal for folders structure division in projects.pdf
Mohamed Ahmed
 
International Journal of Advanced Information Technology (IJAIT)
International Journal of Advanced Information Technology (IJAIT)
ijait
 
MATERIAL SCIENCE LECTURE NOTES FOR DIPLOMA STUDENTS
MATERIAL SCIENCE LECTURE NOTES FOR DIPLOMA STUDENTS
SAMEER VISHWAKARMA
 
تقرير عن التحليل الديناميكي لتدفق الهواء حول جناح.pdf
تقرير عن التحليل الديناميكي لتدفق الهواء حول جناح.pdf
محمد قصص فتوتة
 
Complete guidance book of Asp.Net Web API
Complete guidance book of Asp.Net Web API
Shabista Imam
 
May 2025: Top 10 Read Articles in Data Mining & Knowledge Management Process
May 2025: Top 10 Read Articles in Data Mining & Knowledge Management Process
IJDKP
 
Tally.ERP 9 at a Glance.book - Tally Solutions .pdf
Tally.ERP 9 at a Glance.book - Tally Solutions .pdf
Shabista Imam
 
20CE404-Soil Mechanics - Slide Share PPT
20CE404-Soil Mechanics - Slide Share PPT
saravananr808639
 
Introduction to Python Programming Language
Introduction to Python Programming Language
merlinjohnsy
 
Rapid Prototyping for XR: Lecture 6 - AI for Prototyping and Research Directi...
Rapid Prototyping for XR: Lecture 6 - AI for Prototyping and Research Directi...
Mark Billinghurst
 
دراسة حاله لقرية تقع في جنوب غرب السودان
دراسة حاله لقرية تقع في جنوب غرب السودان
محمد قصص فتوتة
 
DESIGN OF REINFORCED CONCRETE ELEMENTS S
DESIGN OF REINFORCED CONCRETE ELEMENTS S
prabhusp8
 

Looping (Computer programming and utilization)

  • 2. Content. • [1] Looping statement. • [2] WHILE LOOP. • [3] DO WHILE LOOP. • [4] FOR LOOP.
  • 3. LOOPING • Looping is the process of repeatedly executing a block of statements until some conditions for the termination of the loop are satisfied. • Two types of loop structure are: • 1) pretest • 2) posttest
  • 4. Pretest v/s posttest Pretest • Condition is tested before each iteration to check if loops should occur. • eg: For & while loop. Posttest • Condition is tested after each iteration to check if loops should continue (at least a single iteration occurs). • Eg: do while loop.
  • 5. The while statement • It is an entry-controlled loop statement. The test condition is evaluated and if it is true, the body of the loop is executed. After execution of the body, the condition is again evaluated and if it is true, the body of the loop is executed again. This process continuous until the test condition becomes false and the control is transferred out of the loop.
  • 8. The do_while statement • It is an exit controlled loop statement. The body of the loop of do statement is compulsorily executed for the first time. After executing once., at the end of the loop, the test condition in the while statement is evaluated. If the condition is true, the body of the loop is executed again and this process continuous until the condition becomes false, the loop execution is terminated and the control goes to the statement that appears after the while statement.
  • 9. Syntax: Do { body of the loop } While (test condition); Statement-x;
  • 11. The for statement: • It is also an entry-controlled loop. • All for loops are executed in following sequence. • 1] it executes initialization statements • 2] it check the test condition if true than go to step:3 other wise step 4. • 3] execute body of loop and go to step 2 after increment or decrement • 4] other statement of the program.
  • 12. Syntax: For(initialization; test condition; increment) { body of the loop }
  • 13. •Different ways of using for loop: •More than one variable can be initialized in the for loop. For(p=1, n=0; n<4; ++n) •The increment section may contain more than one part. For(p=1,n=0; n<4; ++n, ++p) •You can either do increment or decrement. For(n=4; n>0; -n) •You can also omit one or more sections in the for loop. For( ; n<4; )