Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

What will be the output for the following code?

What will be the output for the following code?

int main()
{
int a=5,b=7
switch(a)
{
case 5 :printf(""I am 5"");
break
case 7: printf(""I am not 5"");
break;
default:printf(""I am different"");
}
return 0;
}

A. I am 5
B. I am not 5
C. I am different
D. Error
by

1 Answer

akshay1995
Ans : D
Explanation: This program will generate an error as the break statement does not end with an semi-colon in case 5.

Login / Signup to Answer the Question.