Home » C Programming » Decision Making » Question
  1. Which of the following is the correct output for the program given below?
    #include <stdio.h>
    int main ()
    {
    int a = 400, b, c;
    if ( a >= 500)
    b = 400;
    c = 300;
    printf ( "%d %d %d \n" , a, b, c);
    return 0;
    }
    1. 400 400 300
    2. Garbage 400 300
    3. 400 Garbage 300
    4. 400 400 Garbage`
Correct Option: C

if( a >= 500) is equivalent to if(false).
So the initialization of b will never be done.
Output
400 Garbage 300



Your comments will be displayed only after manual approval.