Home » C Programming » Loops » Question
  1. What will be the output of the following C code?
     #include <stdio.h>
    int main()
    {
    int k = 0, L = 0;
    while (Level1: k < 5)
    {
    k++;
    while (L < 6)
    {
    printf("Interveiw Maina\n");
    goto Level1;
    }
    }
    }
    1. "Interveiw Maina" is printed one time
    2. "Interveiw Maina" is printed infinite time
    3. Compilation Error
    4. Garbage value
    5. None of these
Correct Option: C

Compilation Error

main.c: In function ‘main’:
main.c:5:16: error: ‘Level1’ undeclared (first use in this function)
while (Level1: k < 5)
^~~~~~
main.c:5:16: note: each undeclared identifier is reported only once for each function it appears in
main.c:5:22: error: expected ‘)’ before ‘:’ token
while (Level1: k < 5)
^
main.c:11:17: error: label ‘Level1’ used but not defined
goto Level1;



Your comments will be displayed only after manual approval.