Skip to content
Related Articles
Open in App
Not now

Related Articles

C | Loops & Control Structure | Question 21

Improve Article
Save Article
Like Article
  • Difficulty Level : Easy
  • Last Updated : 18 Jan, 2014
Improve Article
Save Article
Like Article




#include<stdio.h>
int main()
{
    int a = 5;
    switch(a)
    {
    default:
        a = 4;
    case 6:
        a--;
    case 5:
        a = a+1;
    case 1:
        a = a-1;
    }
    printf("%d \n", a);
    return 0;
}


(A) 3
(B) 4
(C) 5
(D) None of these


Answer: (C)

Explanation: There is no break statement, so first a = a + 1 is executed, then a = a-1 is executed.

Quiz of this Question

My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!