Home » C Programming » Loops » Question
  1. Which of the following is the correct output for the program given below?
    #include <stdio.h>
    int main ( )
    {
    int a = 0;
    for (; a < 5 ; a++);
    printf ("%d\n", a);
    return 0;
    }
    1. 0 1 2 3 4
    2. 5
    3. 1 2 3 4
    4. 6
Correct Option: B

There is a semicolon after for loop. So its a empty loop.
finally after the execution of loop, the value of a = 5



Your comments will be displayed only after manual approval.