C | Loops & Control Structure | Question 21
#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
Last Updated :
18 Jan, 2014
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...