?
What will be the output of the given program?
What will be the output of the given program?
#include<stdio.h>
void main()
{
float num=5.6;
switch(num){
case 5:printf("5");
case 6:printf("6");
default : printf("0");
break;
}
printf("%d", num);
}
#include<stdio.h>
void main()
{
float num=5.6;
switch(num){
case 5:printf("5");
case 6:printf("6");
default : printf("0");
break;
}
printf("%d", num);
}
Answer & Solution
Correct Answer:
Option
D
compiler error switch expression is not integral. switch statement cannot work on float value.
Join the Discussion
Login to post a comment or share your explanation.
Login