while loop can be addressed as an entry control loop. It is completed in 3 steps.
variable initialization;
while (condition)
{
statements;
variable increment or decrement;
}
//Write a Program to Print First 10 Natural Numbers using while loop.
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
i = 1;
while(i <= 10)
{
printf("%d ",i);
i++;
}
getch();
}
Ask Question