The while loop : While Loop « Statement « C Tutorial






The general format for a while loop is

while (condition) {
        simple or compound statement (body of the loop);
    }
#include<stdio.h>

main(){
   
    int i = 0;
    while (i<5){
        printf(" the value of i is %d\n", i);
        i = i + 1;
    }
}
the value of i is 0
      the value of i is 1
      the value of i is 2
      the value of i is 3
      the value of i is 4








6.7.While Loop
6.7.1.The while loop
6.7.2.Between a while loop and a for loop
6.7.3.Put function into while loop condition statement
6.7.4.While loop and sum integers
6.7.5.while loop nested in a for loop