SlideShare a Scribd company logo
5
Most read
10
Most read
11
Most read
For loop in C
o The for loop in C language is also used to iterate the state
ment or a part of the program several times, like while and do-
while loop.
o But, we can initialize and increment or decrement the varia
ble also at the time of checking the condition in for loop.
o Unlike do while loop, the condition or expression in for loo
p is given before the statement, so it may execute the statement
0 or more times.
For loop in C
When use for loop in C
• For loop is better if number of iteration is known by the
programmer.
Syntax of for loop in C
• The syntax of for loop in c language is given below:
For loop in C
How for loop works
• Initialization
• Condition checking
• Incremented of decremented, and
condition checking
For loop in C
Print table for the given number
using C for loop
Infinitive for loop in C
• If you don't initialize any variable, check
condition and increment or decrement variable in
for loop, it is known as infinitive for loop.
• In other words, if you place 2 semicolons in for
loop, it is known as infinitive for loop.
Nested for loop
• A for loop inside another for loop is called nested for
loop.
• The inner loop runs as many times as there is the limit
of the condition of the external loop.
• Outer loop represent rows and inner loop will represent
column.
• This loop runs as long as the condition in the
parenthesis is true.
• ANSI C allows up to 15 levels of nesting.
Nested for loop
for (initialization; condition; increment/decrement)
{
for (initialization; condition; updation)
{
body of the loop;
}
}
Syntax
Nested for loop
Nested for loop
Example 1
Nested for loop
Example 2

More Related Content

What's hot (20)

PPTX
Loops c++
Shivani Singh
 
PPT
friend function(c++)
Ritika Sharma
 
PPTX
While , For , Do-While Loop
Abhishek Choksi
 
PPT
Input and output in C++
Nilesh Dalvi
 
PPTX
Loop(for, while, do while) condition Presentation
Badrul Alam
 
PPT
Recursion in c
Saket Pathak
 
PPTX
Data Types and Variables In C Programming
Kamal Acharya
 
PPT
Structure of a C program
David Livingston J
 
PPTX
Constructor and Types of Constructors
Dhrumil Panchal
 
PPTX
Switch statement, break statement, go to statement
Raj Parekh
 
PDF
Introduction to c++ ppt
Prof. Dr. K. Adisesha
 
DOCX
Basic structure of c programming
TejaswiB4
 
PPTX
Functions in c language
tanmaymodi4
 
PDF
Algorithm and c language
kamalbeydoun
 
PPTX
Strings in C
Kamal Acharya
 
PPTX
Looping statements in C
Jeya Lakshmi
 
PPT
Array in c
Ravi Gelani
 
PPTX
Nested loops
Neeru Mittal
 
PPT
Operator Overloading
Nilesh Dalvi
 
Loops c++
Shivani Singh
 
friend function(c++)
Ritika Sharma
 
While , For , Do-While Loop
Abhishek Choksi
 
Input and output in C++
Nilesh Dalvi
 
Loop(for, while, do while) condition Presentation
Badrul Alam
 
Recursion in c
Saket Pathak
 
Data Types and Variables In C Programming
Kamal Acharya
 
Structure of a C program
David Livingston J
 
Constructor and Types of Constructors
Dhrumil Panchal
 
Switch statement, break statement, go to statement
Raj Parekh
 
Introduction to c++ ppt
Prof. Dr. K. Adisesha
 
Basic structure of c programming
TejaswiB4
 
Functions in c language
tanmaymodi4
 
Algorithm and c language
kamalbeydoun
 
Strings in C
Kamal Acharya
 
Looping statements in C
Jeya Lakshmi
 
Array in c
Ravi Gelani
 
Nested loops
Neeru Mittal
 
Operator Overloading
Nilesh Dalvi
 

Similar to Forloop (20)

PPTX
C-PROGRAMING FOR LOOP PPT
shrunkhalakumavat
 
PPTX
C Programming: Looping Statements in C Pgm
Navya Francis
 
PPTX
LOOPING IN C- PROGRAMMING.pptx
AFANJIPHILL
 
PPTX
Loop in C Properties & Applications
Emroz Sardar
 
PPTX
DECISION MAKING.pptx
Ayshwarya Baburam
 
DOCX
loops and iteration.docx
JavvajiVenkat
 
PPT
Control structure
Samsil Arefin
 
PDF
Unit II chapter 4 Loops in C
Sowmya Jyothi
 
PDF
whileloop-161225171903.pdf
BasirKhan21
 
PPTX
Loop structures
tazeem sana
 
PPT
While loop
Feras_83
 
PPTX
C loops
sunilchute1
 
PPTX
Loop-1.pptx
MuhammadArsalan896347
 
PDF
LOOP STATEMENTS AND TYPES OF LOOP IN C LANGUAGE BY RIZWAN
MD RIZWAN MOLLA
 
PPT
Programs in C based on looping statements
Chithra720576
 
PPTX
Loops in c ii
Yugal Kumar
 
PPTX
Loops in c ii
Yugal Kumar
 
PPT
Decision making and looping
Hossain Md Shakhawat
 
PPTX
While loop and for loop 06 (js)
AbhishekMondal42
 
PDF
cpu.pdf
RAJCHATTERJEE24
 
C-PROGRAMING FOR LOOP PPT
shrunkhalakumavat
 
C Programming: Looping Statements in C Pgm
Navya Francis
 
LOOPING IN C- PROGRAMMING.pptx
AFANJIPHILL
 
Loop in C Properties & Applications
Emroz Sardar
 
DECISION MAKING.pptx
Ayshwarya Baburam
 
loops and iteration.docx
JavvajiVenkat
 
Control structure
Samsil Arefin
 
Unit II chapter 4 Loops in C
Sowmya Jyothi
 
whileloop-161225171903.pdf
BasirKhan21
 
Loop structures
tazeem sana
 
While loop
Feras_83
 
C loops
sunilchute1
 
LOOP STATEMENTS AND TYPES OF LOOP IN C LANGUAGE BY RIZWAN
MD RIZWAN MOLLA
 
Programs in C based on looping statements
Chithra720576
 
Loops in c ii
Yugal Kumar
 
Loops in c ii
Yugal Kumar
 
Decision making and looping
Hossain Md Shakhawat
 
While loop and for loop 06 (js)
AbhishekMondal42
 
Ad

Recently uploaded (20)

PPTX
ENGLISH 8 WEEK 3 Q1 - Analyzing the linguistic, historical, andor biographica...
OliverOllet
 
PPTX
Introduction to Probability(basic) .pptx
purohitanuj034
 
PPTX
Electrophysiology_of_Heart. Electrophysiology studies in Cardiovascular syste...
Rajshri Ghogare
 
PPTX
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
PPTX
Artificial Intelligence in Gastroentrology: Advancements and Future Presprec...
AyanHossain
 
PPTX
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
PDF
My Thoughts On Q&A- A Novel By Vikas Swarup
Niharika
 
PPTX
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
PDF
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
PPTX
I INCLUDED THIS TOPIC IS INTELLIGENCE DEFINITION, MEANING, INDIVIDUAL DIFFERE...
parmarjuli1412
 
PPTX
The Future of Artificial Intelligence Opportunities and Risks Ahead
vaghelajayendra784
 
PPT
DRUGS USED IN THERAPY OF SHOCK, Shock Therapy, Treatment or management of shock
Rajshri Ghogare
 
PPTX
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
PPTX
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
PPTX
Applied-Statistics-1.pptx hardiba zalaaa
hardizala899
 
PDF
Tips for Writing the Research Title with Examples
Thelma Villaflores
 
PPTX
Basics and rules of probability with real-life uses
ravatkaran694
 
PPTX
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
DOCX
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
PPTX
Digital Professionalism and Interpersonal Competence
rutvikgediya1
 
ENGLISH 8 WEEK 3 Q1 - Analyzing the linguistic, historical, andor biographica...
OliverOllet
 
Introduction to Probability(basic) .pptx
purohitanuj034
 
Electrophysiology_of_Heart. Electrophysiology studies in Cardiovascular syste...
Rajshri Ghogare
 
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
Artificial Intelligence in Gastroentrology: Advancements and Future Presprec...
AyanHossain
 
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
My Thoughts On Q&A- A Novel By Vikas Swarup
Niharika
 
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
I INCLUDED THIS TOPIC IS INTELLIGENCE DEFINITION, MEANING, INDIVIDUAL DIFFERE...
parmarjuli1412
 
The Future of Artificial Intelligence Opportunities and Risks Ahead
vaghelajayendra784
 
DRUGS USED IN THERAPY OF SHOCK, Shock Therapy, Treatment or management of shock
Rajshri Ghogare
 
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
Applied-Statistics-1.pptx hardiba zalaaa
hardizala899
 
Tips for Writing the Research Title with Examples
Thelma Villaflores
 
Basics and rules of probability with real-life uses
ravatkaran694
 
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
Digital Professionalism and Interpersonal Competence
rutvikgediya1
 
Ad

Forloop

  • 1. For loop in C o The for loop in C language is also used to iterate the state ment or a part of the program several times, like while and do- while loop. o But, we can initialize and increment or decrement the varia ble also at the time of checking the condition in for loop. o Unlike do while loop, the condition or expression in for loo p is given before the statement, so it may execute the statement 0 or more times.
  • 2. For loop in C When use for loop in C • For loop is better if number of iteration is known by the programmer. Syntax of for loop in C • The syntax of for loop in c language is given below:
  • 3. For loop in C How for loop works • Initialization • Condition checking • Incremented of decremented, and condition checking
  • 5. Print table for the given number using C for loop
  • 6. Infinitive for loop in C • If you don't initialize any variable, check condition and increment or decrement variable in for loop, it is known as infinitive for loop. • In other words, if you place 2 semicolons in for loop, it is known as infinitive for loop.
  • 7. Nested for loop • A for loop inside another for loop is called nested for loop. • The inner loop runs as many times as there is the limit of the condition of the external loop. • Outer loop represent rows and inner loop will represent column. • This loop runs as long as the condition in the parenthesis is true. • ANSI C allows up to 15 levels of nesting.
  • 8. Nested for loop for (initialization; condition; increment/decrement) { for (initialization; condition; updation) { body of the loop; } } Syntax