Q40
What will be the output of the given program? #include void main() float num=5.6; switch(num) case 5:printf("5"); case 6:printf("6"); default : printf("0"); break; printf("%d", num);
A.
5 5.600000
B.
6 5.600000
C.
0 5.600000
D.
Complier error
AnswerAnswer: Option D
Solution
Answer: Option D
Solution:
compiler error switch expression is not integral. switch statement cannot work on float value.