Open In App
Related Articles

C | Loops & Control Structure | Question 3

Improve Article
Improve
Save Article
Save
Like Article
Like

What is the output of the below program? 

C




#include <stdio.h>
 
int main() {
    int i = 2;
    switch (i) {
        case 0:
            printf("Geeks");
            break;
        case 1:
            printf("Quiz");
            break;
        default:
            printf("GeeksQuiz");
    }
    return 0;
}

(A)

Geeks

(B)

Quiz

(C)

GeeksQuiz

(D)

Compile-time error



Answer: (C)

Explanation:

As i=2, so GeeksQuiz is printed.


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