For | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

For

#include <stdio.h> int main() { int a=6; int b=9; for (;;){ if (a>=b) break; printf ("%d", a++); } } What does (;;) do?

10th Oct 2021, 8:12 AM
Ma1
1 Answer
+ 1
You have declared two variables a and b after that you have used one loop i i think here u missed something initialisation of loop i supposed loop working infinite times inside loop u have written condition a>=b means 6>=9 and a is increasing if this condition will be true then you will be exit from loop becz u used break statement otherwise a value will be print everytime. When 6>=9 false so if condition won't execute And printf will print 6 then a++ next time condition will be 7>=9 false Again print a value then a++ 8>=9 false When it will reach till 9 here condition will be true and u will exit from loop
10th Oct 2021, 8:21 AM
A S Raghuvanshi
A S Raghuvanshi - avatar