The while construct consists of a block of code and a condition. The condition is evaluated, and if the condition is true, the code within the block is executed. This repeats until the condition becomes false. Because the while loop checks the condition before the block is executed.
The control structure is often also known as a pre-test loop. Compare this with the do while loop, which tests the condition after the loop has executed.
The while loop is also called entry control loop the following digram represent the entry control loop process.
while(condition)
{
statement;
}
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
clrscr();
i=1;
while(i<=10)
{
printf("\n%d",i);
i++;
}
getch();
}