Home / C Programming / Control Structures :: Discussion

Discussion :: Control Structures

  1. What will be the output of given program?

    #include<stdio.h>

    void main()

    {

    int a=3;

    for(;a;printf("%d ", a--);

    }

  2. A.

     no output

    B.

     3 2 1 0

    C.

     3 2 1

    D.

     infinity loop

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    Decrement operator in

    for

    loop statement are executed until the condition is true.
    So it is executed till "a" not equal to zero and printf statement inside

    for

    loop print a value of "a"


Be The First To Comment