What would the output of following program written in c

What would the output of following program written in c?

 

#include <stdlib.h>
#include <stdio.h>
enum {false, true};
int main()
{
   int i = 1;
   do
   {
      printf("%d\n", i);
      i++;
      if (i < 15)
        continue;
   } while (false);
 
   getchar();
   return 0;
}
Asked on January 12, 2020 in program.
Add Comment
1 Answer(s)

Output: 1

Explanation: The do while loop checks condition after each iteration.

So after continue statement, control transfers to the statement while(false). Since the condition is false ‘i’ is printed only once.

Answered on January 12, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.