Mega Code Archive

 
Categories / C Tutorial / Statement
 

The while loop

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