Switch case MCQ 20 : Floating Numbers are not allowed
TAGS :
- Does Floating Point numbers allowed in switch case ?
- Floating Point in Switch Label !!!
Problem Statement 20 : Floating Numbers are not allowed
void main() { float choice = 10.1 ; switch(choice) { case 10.1 : printf("\nCase 10.1"); break; case 10.2 : printf("nCase 10.2"); break; case 10.3 : printf("nCase 10.3"); break; } }
Options : Is it working properly ?
- Yes
- No
Output
No
How ? Why ?
- Case Labels won’t allow you to use Floating Number