Open In App
Related Articles

C | Loops & Control Structure | Question 5

Improve Article
Improve
Save Article
Save
Like Article
Like

Predict the output of the below program: 

C




#include <stdio.h>
 
#define EVEN 0
#define ODD 1
 
int main() {
    int i = 3;
    switch (i % 2) {
        case EVEN:
            printf("Even");
            break;
        case ODD:
            printf("Odd");
            break;
        default:
            printf("Default");
    }
    return 0;
}

(A)

Even

(B)

Odd

(C)

Default

(D)

Compile-time error



Answer: (B)

Explanation:

The following C code will print ‘odd’ as the output of the program.


Quiz of this Question
Please comment below if you find anything wrong in the above post

Last Updated : 12 Jan, 2013
Like Article
Save Article
Similar Reads