Switch case MCQ 19: Comparison not allowed in Case Label

Switch case MCQ 19: Comparison not allowed in Case Label


Problem Statement 19 : Comparison not allowed in Case Label

void main()
{
   int choice = 10 ;
   switch(choice) 
   {
    case <10:
         printf("nLess than 10");
         break;
    case =10:
         printf("nEqual to 10");
         break;
    case >10:
         printf("nGreater than 10");
         break;
   }
}

Options : Is it working properly ?

  1. Yes
  2. No

[toggle title="Output"]No[/toggle]

How ? Why ?

  • Case Labels won’t allow you to use Comparison Operators