Infinite while loop Example 1

C Programming Language Loop control in C Language (Article) Loop control in C Language (Program)

1136

Program:

#include <stdio.h>
int main()
{
     int var = 6;
     while (var >=5)
     {
        printf("%d \n", var);
        var++;
     }
   return 0;
}

Output:

51232
51233
51234
51235
51236
51237
51238
51239
51240
51241
........
........
........
infinite time

Explanation:

Infinite loop: var will always have value >=5 so the loop would never end.

This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.