0 votes 0 votes 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); } Algorithms iisccsaresearch2016 descriptive algorithms identify-function iisc-interview + – go_editor asked Jun 7, 2016 go_editor 410 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
2 votes 2 votes 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 srestha answered Jun 7, 2016 edited Jun 8, 2016 by srestha srestha comment Share Follow See all 2 Comments See all 2 2 Comments reply shivanisrivarshini commented Jun 8, 2016 reply Follow Share Here continue jumps to condition i.e while(i<7) 1 votes 1 votes srestha commented Jun 8, 2016 reply Follow Share continue skips some code If there is some code after continue it just go to the next iteration of the loop without looking at the codes 1 votes 1 votes Please log in or register to add a comment.