SlideShare a Scribd company logo
1 of 8
FOR LOOP
A presentation by:
ROHIT SONI
&
SACHIN SHARMA
Iteration Statements
■ Used to iterate or re-use a set of instructions
■ Saves programming time
■ Reduce number of lines of code
■ Ultimately makes a program more efficient
Iteration
Statements
For Loop While Loop
Do-While
Loop
Iteration Statements
■ Iteration Statements have three part:
– Initialization
– Condition
– Increment/Decrement
 Initialization: Initializes the loop variable.
 Condition: The loop will execute till the condition is met.
 Increment/Decrement: It alters the value of the loop variable.
FOR Loop
■ It is a entry control loop i.e. the condition is checked before executing the loop
statements
■ It is used to iterate a set of lines/instructions
■ Initialization, Condition and Increment/Decrement all resides together at the top of
the statement
■ Mostly used while working with arrays or while printing some patterns
FOR loop – SYNTAX
for ( initialization; condition; increment_or_decrement )
{
//Set of instructions to be iterated
}
Different cases in FOR loop
1. If increment/decrement or condition is missing from the loop, It will run infinitely
2. Initialization can be done outside (above) the loop too.
Different cases in FOR loop
3. Another way to start infinite loop
4. Semicolon in front of for loop statement: Loop executes but didn’t take any
statements under it. i.e. Empty loop will run
Basic for Loop in C

More Related Content

What's hot

Looping statement
Looping statementLooping statement
Looping statement
ilakkiya
 
Looping statements in C
Looping statements in CLooping statements in C
Looping statements in C
Jeya Lakshmi
 

What's hot (20)

Looping statement
Looping statementLooping statement
Looping statement
 
30. 8086 microprocessor pipelined architecture
30. 8086 microprocessor pipelined architecture30. 8086 microprocessor pipelined architecture
30. 8086 microprocessor pipelined architecture
 
Loop(for, while, do while) condition Presentation
Loop(for, while, do while) condition PresentationLoop(for, while, do while) condition Presentation
Loop(for, while, do while) condition Presentation
 
Loops in C Programming Language
Loops in C Programming LanguageLoops in C Programming Language
Loops in C Programming Language
 
Looping statements in C
Looping statements in CLooping statements in C
Looping statements in C
 
Control structures in C
Control structures in CControl structures in C
Control structures in C
 
MULTIPLEXER
MULTIPLEXERMULTIPLEXER
MULTIPLEXER
 
Loops in c
Loops in cLoops in c
Loops in c
 
Encoder and decoder
Encoder and decoderEncoder and decoder
Encoder and decoder
 
Loops in c++ programming language
Loops in c++ programming language Loops in c++ programming language
Loops in c++ programming language
 
Introduction to c programming language
Introduction to c programming languageIntroduction to c programming language
Introduction to c programming language
 
Loops in c
Loops in cLoops in c
Loops in c
 
Data type in c
Data type in cData type in c
Data type in c
 
C Programming: Control Structure
C Programming: Control StructureC Programming: Control Structure
C Programming: Control Structure
 
decoder and encoder
 decoder and encoder decoder and encoder
decoder and encoder
 
Looping (Computer programming and utilization)
Looping (Computer programming and utilization)Looping (Computer programming and utilization)
Looping (Computer programming and utilization)
 
8085 microprocessor ramesh gaonkar
8085 microprocessor   ramesh gaonkar8085 microprocessor   ramesh gaonkar
8085 microprocessor ramesh gaonkar
 
Loops in C
Loops in CLoops in C
Loops in C
 
Parallel Adder and Subtractor
Parallel Adder and SubtractorParallel Adder and Subtractor
Parallel Adder and Subtractor
 
Parity generator & checker
Parity generator & checkerParity generator & checker
Parity generator & checker
 

Viewers also liked

C Prog. - Decision & Loop Controls
C Prog. - Decision & Loop ControlsC Prog. - Decision & Loop Controls
C Prog. - Decision & Loop Controls
vinay arora
 

Viewers also liked (6)

C program language tutorial for loop while loop do while loop
C program language tutorial for loop while loop do while loopC program language tutorial for loop while loop do while loop
C program language tutorial for loop while loop do while loop
 
Memory allocation in c
Memory allocation in cMemory allocation in c
Memory allocation in c
 
Structure in C
Structure in CStructure in C
Structure in C
 
detailed information about Pointers in c language
detailed information about Pointers in c languagedetailed information about Pointers in c language
detailed information about Pointers in c language
 
C Prog. - Decision & Loop Controls
C Prog. - Decision & Loop ControlsC Prog. - Decision & Loop Controls
C Prog. - Decision & Loop Controls
 
C Pointers
C PointersC Pointers
C Pointers
 

Similar to Basic for Loop in C

c++ Lecture 3
c++ Lecture 3c++ Lecture 3
c++ Lecture 3
sajidpk92
 

Similar to Basic for Loop in C (20)

loops and iteration.docx
loops and iteration.docxloops and iteration.docx
loops and iteration.docx
 
Loops In C++
Loops In C++Loops In C++
Loops In C++
 
Object oriented programming18 control structures looping
Object oriented programming18 control structures loopingObject oriented programming18 control structures looping
Object oriented programming18 control structures looping
 
Loop-1.pptx
Loop-1.pptxLoop-1.pptx
Loop-1.pptx
 
control structures in c if switch for
control structures in c if switch forcontrol structures in c if switch for
control structures in c if switch for
 
[ITP - Lecture 11] Loops in C/C++
[ITP - Lecture 11] Loops in C/C++[ITP - Lecture 11] Loops in C/C++
[ITP - Lecture 11] Loops in C/C++
 
Programming Fundamentals in C++ structures
Programming Fundamentals in  C++ structuresProgramming Fundamentals in  C++ structures
Programming Fundamentals in C++ structures
 
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
 
While loop and for loop 06 (js)
While loop and for loop 06 (js)While loop and for loop 06 (js)
While loop and for loop 06 (js)
 
c++ Lecture 3
c++ Lecture 3c++ Lecture 3
c++ Lecture 3
 
Visula C# Programming Lecture 4
Visula C# Programming Lecture 4Visula C# Programming Lecture 4
Visula C# Programming Lecture 4
 
Loops IN COMPUTER SCIENCE STANDARD 11 BY KR
Loops IN COMPUTER SCIENCE STANDARD 11 BY KRLoops IN COMPUTER SCIENCE STANDARD 11 BY KR
Loops IN COMPUTER SCIENCE STANDARD 11 BY KR
 
Fundamentals of Programming Chapter 7
Fundamentals of Programming Chapter 7Fundamentals of Programming Chapter 7
Fundamentals of Programming Chapter 7
 
Chapter 12 Computer Science ( ICS 12).pdf
Chapter 12 Computer Science ( ICS 12).pdfChapter 12 Computer Science ( ICS 12).pdf
Chapter 12 Computer Science ( ICS 12).pdf
 
Repetition, Basic loop structures, Loop programming techniques
Repetition, Basic loop structures, Loop programming techniquesRepetition, Basic loop structures, Loop programming techniques
Repetition, Basic loop structures, Loop programming techniques
 
Loops c++
Loops c++Loops c++
Loops c++
 
Loop
LoopLoop
Loop
 
Loops Do While Arduino Programming Robotics
Loops Do While Arduino Programming  RoboticsLoops Do While Arduino Programming  Robotics
Loops Do While Arduino Programming Robotics
 
Loop in C Properties & Applications
Loop in C Properties & ApplicationsLoop in C Properties & Applications
Loop in C Properties & Applications
 
Cse lecture-7-c loop
Cse lecture-7-c loopCse lecture-7-c loop
Cse lecture-7-c loop
 

Recently uploaded

Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
AldoGarca30
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
MayuraD1
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
Computer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesComputer Graphics Introduction To Curves
Computer Graphics Introduction To Curves
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Electromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptxElectromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptx
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using PipesLinux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Ground Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementGround Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth Reinforcement
 
fitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptfitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .ppt
 
Introduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdfIntroduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdf
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 

Basic for Loop in C

  • 1. FOR LOOP A presentation by: ROHIT SONI & SACHIN SHARMA
  • 2. Iteration Statements ■ Used to iterate or re-use a set of instructions ■ Saves programming time ■ Reduce number of lines of code ■ Ultimately makes a program more efficient Iteration Statements For Loop While Loop Do-While Loop
  • 3. Iteration Statements ■ Iteration Statements have three part: – Initialization – Condition – Increment/Decrement  Initialization: Initializes the loop variable.  Condition: The loop will execute till the condition is met.  Increment/Decrement: It alters the value of the loop variable.
  • 4. FOR Loop ■ It is a entry control loop i.e. the condition is checked before executing the loop statements ■ It is used to iterate a set of lines/instructions ■ Initialization, Condition and Increment/Decrement all resides together at the top of the statement ■ Mostly used while working with arrays or while printing some patterns
  • 5. FOR loop – SYNTAX for ( initialization; condition; increment_or_decrement ) { //Set of instructions to be iterated }
  • 6. Different cases in FOR loop 1. If increment/decrement or condition is missing from the loop, It will run infinitely 2. Initialization can be done outside (above) the loop too.
  • 7. Different cases in FOR loop 3. Another way to start infinite loop 4. Semicolon in front of for loop statement: Loop executes but didn’t take any statements under it. i.e. Empty loop will run