Looping Statement Are The Statements Execute One or More Statement Repeatedly Several Number of Times
Looping Statement Are The Statements Execute One or More Statement Repeatedly Several Number of Times
Looping statement are the statements execute one or more statement repeatedly several number of times.
•while loop
•for loop
•do..while
In while loop First check the condition if condition is true then control goes inside the loop body
#include<stdio.h>
#include<conio.h>
void main() Output
{
int i;
clrscr(); 1
i=1;
while(i<5) 2
{
printf("\n%d",i);
3
i++; 4
}
getch();
}
For loop
#include<stdio.h>
#include<conio.h>
void main() Output
{
int i; 1
clrscr();
2
for(i=1;i<5;i++)
{ 3
printf("\n%d",i); 4
}
getch();
}