The Wayback Machine - https://web.archive.org/web/20240204104354/https://www.geeksforgeeks.org/c-loops-control-structure-question-3/
Open In App
Related Articles

C | Loops & Control Structure | Question 3

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

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

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Looking for a place to share your ideas, learn, and connect? Our Community portal is just the spot! Come join us and see what all the buzz is about!


Last Updated : 12 Jan, 2013
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads