While Loop in C
March 7, 2020
Like do-while loop, While loop is the most commonly used looping construct to repeat a process or calculation for a set or collection of inputs or storage based on a condition. It is a looping technique when you want to execute the required process based on a condition for the entire input collection. Below is a simple C program using while looping.
Example 1: Rocket count down
main(){
int a = 10;
while( a >= 0 ){
printf("%d.\n",a);
}
printf("The rocket takes off..\n");
}