SlideShare a Scribd company logo
1 of 5
Download to read offline
Abdulmajeed Khalil abukojar
214361612
Abdulmajeed Khalil abukojar
Programing
Loop Program
What is Loop Program ?
The Loop Program is continuing operation that make the operation re-
peatedly till it reaches to a certain condition.
Types of looping:-
FOR Loops:-
for loops are the most useful type.
Variable initialization:-
the variable initialization lets you declare a variable and give it a value or
give a value to an already existing variable.
variable initialization tells the program that while the conditional
expression is true the loop must keep repeat itself. The variable update
part is the easiest way for a for loop to handle changing of the variable.
Example:
#include <iostream>
using namespace std;
int main()
{
for ( int x = 0; x < 10; x++ ) {
cout<< x <<endl;
}
cin.get();
}
While Loop:
The basic structure is :-
*NOTE*
Notice that the condition is tested at the end of the block instead of the
start, so the block will be executed at least one time. If the condition is
true, we return to the beginning of the block and do it again. A do..while
loop is basically a reversed while loop. A while loop says “Loop while
the condition is true, and execute this block of code”, a do..while loop
says “Execute this block of code, and loop while the condition is true”.
Example:
#include <iostream>
using namespace std;
int main()
{
int x;
x = 0;
do {
// “Hello, world!” is printed at least one time
// even though the condition is false
cout<<”Hello, world!n”;
} while ( x != 0 );
cin.get();
}

More Related Content

What's hot

Looping statements in Java
Looping statements in JavaLooping statements in Java
Looping statements in Java
Jin Castor
 
JavaScript Loop: Optimization of Weak Typing
JavaScript Loop: Optimization of Weak TypingJavaScript Loop: Optimization of Weak Typing
JavaScript Loop: Optimization of Weak Typing
Janlay Wu
 

What's hot (20)

C++ loop
C++ loop C++ loop
C++ loop
 
Loops in c
Loops in cLoops in c
Loops in c
 
Asynchronous JavaScript Programming with Callbacks & Promises
Asynchronous JavaScript Programming with Callbacks & PromisesAsynchronous JavaScript Programming with Callbacks & Promises
Asynchronous JavaScript Programming with Callbacks & Promises
 
Closures
ClosuresClosures
Closures
 
While and For Loops
While and For LoopsWhile and For Loops
While and For Loops
 
Introduction to php 5
Introduction to php   5Introduction to php   5
Introduction to php 5
 
170120107074 looping statements and nesting of loop statements
170120107074 looping statements and nesting of loop statements170120107074 looping statements and nesting of loop statements
170120107074 looping statements and nesting of loop statements
 
Looping statements in Java
Looping statements in JavaLooping statements in Java
Looping statements in Java
 
Java loops
Java loopsJava loops
Java loops
 
CFML Enhancements in ColdFusion 10
CFML Enhancements in ColdFusion 10 CFML Enhancements in ColdFusion 10
CFML Enhancements in ColdFusion 10
 
Loop c++
Loop c++Loop c++
Loop c++
 
Loops in JavaScript
Loops in JavaScriptLoops in JavaScript
Loops in JavaScript
 
Intro to Asynchronous Javascript
Intro to Asynchronous JavascriptIntro to Asynchronous Javascript
Intro to Asynchronous Javascript
 
Cpp loop types
Cpp loop typesCpp loop types
Cpp loop types
 
JavaScript Loop: Optimization of Weak Typing
JavaScript Loop: Optimization of Weak TypingJavaScript Loop: Optimization of Weak Typing
JavaScript Loop: Optimization of Weak Typing
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
Open World Forum 2014 : From ES6 to Javascript 2.0. What use today ? par Jon...
Open World Forum 2014  : From ES6 to Javascript 2.0. What use today ? par Jon...Open World Forum 2014  : From ES6 to Javascript 2.0. What use today ? par Jon...
Open World Forum 2014 : From ES6 to Javascript 2.0. What use today ? par Jon...
 
Loops
LoopsLoops
Loops
 
Inline and lambda function
Inline and lambda functionInline and lambda function
Inline and lambda function
 
Looping statements
Looping statementsLooping statements
Looping statements
 

Viewers also liked

Property without Government
Property without GovernmentProperty without Government
Property without Government
Knox Ridley III
 
Nollakohdat toinenaste
Nollakohdat toinenasteNollakohdat toinenaste
Nollakohdat toinenaste
teemunmatikka
 
Potenssien laskusäännöt
Potenssien laskusäännötPotenssien laskusäännöt
Potenssien laskusäännöt
eiraedu
 
tech-consultnettingmaterials
tech-consultnettingmaterialstech-consultnettingmaterials
tech-consultnettingmaterials
Fernando Merino
 
Blizzard Entertainment Presentation
Blizzard Entertainment PresentationBlizzard Entertainment Presentation
Blizzard Entertainment Presentation
acetoky
 

Viewers also liked (12)

Property without Government
Property without GovernmentProperty without Government
Property without Government
 
Gatos
GatosGatos
Gatos
 
9. Общая экономика 2017: Процесс обращения капитала. Метаморфозы капитала и и...
9. Общая экономика 2017: Процесс обращения капитала. Метаморфозы капитала и и...9. Общая экономика 2017: Процесс обращения капитала. Метаморфозы капитала и и...
9. Общая экономика 2017: Процесс обращения капитала. Метаморфозы капитала и и...
 
Miguel reale
Miguel realeMiguel reale
Miguel reale
 
3. Общая экономика, 2017: Форма стоимости. Процесс обмена (1. General Economi...
3. Общая экономика, 2017: Форма стоимости. Процесс обмена (1. General Economi...3. Общая экономика, 2017: Форма стоимости. Процесс обмена (1. General Economi...
3. Общая экономика, 2017: Форма стоимости. Процесс обмена (1. General Economi...
 
Nollakohdat toinenaste
Nollakohdat toinenasteNollakohdat toinenaste
Nollakohdat toinenaste
 
Potenssien laskusäännöt
Potenssien laskusäännötPotenssien laskusäännöt
Potenssien laskusäännöt
 
Derivoiminen
DerivoiminenDerivoiminen
Derivoiminen
 
Tallerpractico10 janeiro 7
Tallerpractico10 janeiro 7Tallerpractico10 janeiro 7
Tallerpractico10 janeiro 7
 
tech-consultnettingmaterials
tech-consultnettingmaterialstech-consultnettingmaterials
tech-consultnettingmaterials
 
Blizzard Entertainment Presentation
Blizzard Entertainment PresentationBlizzard Entertainment Presentation
Blizzard Entertainment Presentation
 
04 pipeline-channel hydraulics
04 pipeline-channel hydraulics04 pipeline-channel hydraulics
04 pipeline-channel hydraulics
 

Similar to Programming

Switch case and looping
Switch case and loopingSwitch case and looping
Switch case and looping
aprilyyy
 

Similar to Programming (20)

Loop structures
Loop structuresLoop structures
Loop structures
 
Deeksha gopaliya
Deeksha gopaliyaDeeksha gopaliya
Deeksha gopaliya
 
Loops In C++
Loops In C++Loops In C++
Loops In C++
 
Looping in c++
Looping in c++Looping in c++
Looping in c++
 
Looping in c++
Looping in c++Looping in c++
Looping in c++
 
Loops in c++
Loops in c++Loops in c++
Loops in c++
 
2nd year computer science chapter 12 notes
2nd year computer science chapter 12 notes2nd year computer science chapter 12 notes
2nd year computer science chapter 12 notes
 
loops and iteration.docx
loops and iteration.docxloops and iteration.docx
loops and iteration.docx
 
dizital pods session 5-loops.pptx
dizital pods session 5-loops.pptxdizital pods session 5-loops.pptx
dizital pods session 5-loops.pptx
 
Loops c++
Loops c++Loops c++
Loops c++
 
whileloop-161225171903.pdf
whileloop-161225171903.pdfwhileloop-161225171903.pdf
whileloop-161225171903.pdf
 
itretion.docx
itretion.docxitretion.docx
itretion.docx
 
Chapter 3 - Flow of Control Part II.pdf
Chapter 3  - Flow of Control Part II.pdfChapter 3  - Flow of Control Part II.pdf
Chapter 3 - Flow of Control Part II.pdf
 
Loops
LoopsLoops
Loops
 
Computer programming 2 Lesson 8
Computer programming 2  Lesson 8Computer programming 2  Lesson 8
Computer programming 2 Lesson 8
 
Comp ppt (1)
Comp ppt (1)Comp ppt (1)
Comp ppt (1)
 
Switch case and looping
Switch case and loopingSwitch case and looping
Switch case and looping
 
What is loops? What is For loop?
What is loops? What is For loop?What is loops? What is For loop?
What is loops? What is For loop?
 
Programming in Arduino (Part 2)
Programming in Arduino  (Part 2)Programming in Arduino  (Part 2)
Programming in Arduino (Part 2)
 
Cse lecture-7-c loop
Cse lecture-7-c loopCse lecture-7-c loop
Cse lecture-7-c loop
 

Recently uploaded

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Recently uploaded (20)

fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 

Programming

  • 2. Loop Program What is Loop Program ? The Loop Program is continuing operation that make the operation re- peatedly till it reaches to a certain condition. Types of looping:- FOR Loops:- for loops are the most useful type.
  • 3. Variable initialization:- the variable initialization lets you declare a variable and give it a value or give a value to an already existing variable. variable initialization tells the program that while the conditional expression is true the loop must keep repeat itself. The variable update part is the easiest way for a for loop to handle changing of the variable. Example: #include <iostream> using namespace std; int main() { for ( int x = 0; x < 10; x++ ) { cout<< x <<endl; } cin.get(); }
  • 4. While Loop: The basic structure is :- *NOTE* Notice that the condition is tested at the end of the block instead of the start, so the block will be executed at least one time. If the condition is true, we return to the beginning of the block and do it again. A do..while loop is basically a reversed while loop. A while loop says “Loop while the condition is true, and execute this block of code”, a do..while loop says “Execute this block of code, and loop while the condition is true”.
  • 5. Example: #include <iostream> using namespace std; int main() { int x; x = 0; do { // “Hello, world!” is printed at least one time // even though the condition is false cout<<”Hello, world!n”; } while ( x != 0 ); cin.get(); }