What would the output of c program?

What would be output of the following c program?

#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 25, 2020 in program.

Output: 1

Explanation:

The do wile 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.

 

on January 25, 2020.
Add Comment
1 Answer(s)

Output: 1

Answered 4 days ago.
Add Comment

Your Answer

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