What is the output of the following program?
int main() { int i=0; do { if (i >=5) { i+=2; printf("%d \n", i); break; } else { printf("%d \n", ++i); continue; } } while (i<7); }
It will print 1,2,3,4,5,7
It is a preincrement of i . So every time it first increment and then assign the value and print
So, upto 5 it will print
Then it will go to ' if ' part of program
There i value becomes 7 , breaks the loop and exit
64.3k questions
77.9k answers
244k comments
80.0k users