Professional Documents
Culture Documents
-----------------------------------
---------
Presentation on Loop
By:-
SUKRITI RAI
(B.Sc. 1st year )
UNDER THE SUPERVISION OF
Er. Sachin Jaiswal
Introduction to Loops
* A loop is defined as a block of
statements, which are repeatedly executed
for a certain number of times
* A loop executes the sequence of statement
many times until the stated condition
becomes false.
A loop consists of two parts , a body of a
loop and a control statement
Types of Loops
In Pre – Test Loop, condition is checked before
the beginning of each iteration. If condition is
TRUE repetition is performed, if it is FALSE
repetition is not performed
The initialization expression set the initial value of the loop control variable.
In the while loop , when the condition is true , then the while loop’s statement will
be executed , otherwise not.
The statement is repeated as long as the repetition condition is true
Comparing For and While Loop:---
Program of While Loop:-
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
while(i<=5)
{
printf(“%d \n” , i);
i++;
}
getch();
}
[2].Google.com