Examveda

What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int i = 0, j = 0;
    for (i; i < 2; i++){
        for (j = 0; j < 3; j++)
        {
            printf("1\n");
            break;
        }
        printf("2\n");
    }
    printf("after loop\n");
}

A. 1
2
after loop

B. 1
after loop

C. 1
2
1
2
after loop

D. 1
1
2
after loop

Answer: Option C


This Question Belongs to C Program >> Control Structures

Join The Discussion

Related Questions on Control Structures