title: C - Switch with multiple case numbers
body: <p>So my professor asked us to create a switch statement. We are allowed to use <strong>only the "SWITCH"</strong> statement to do the program. He wants us to input a number and then display it if it is on the number range and what briefcase number will be taken as shown below. Now... I know that for this type of program it is easier to use the <strong>IF statement</strong>. Doing Case 1: Case 2: Case 3...Case 30 will work but will take too much time due to the number range.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  main()
  {
        int x;
        char ch1;
        printf("Enter a number: ");
        scanf("%d",&amp;x);
        switch(x)
        {
                   case 1://for the first case #1-30
                   case 30:
                        printf("The number you entered is &gt;= 1 and &lt;= 30");
                        printf("\nTake Briefcase Number 1");
                        break;         
                   case 31://for the second case #31-59
                   case 59:
                        printf("The number you entered is &gt;= 31 and &lt;= 59");
                        printf("\nTake Briefcase Number 2");
                        break;                 
                   case 60://for the third case #60-89
                   case 89:
                        printf("The number you entered is &gt;= 60 and &lt;= 89");
                        printf("\nTake Briefcase Number 3");
                        break;                 
                   case 90://for the fourth case #90-100
                   case 100:
                        printf("The number you entered is &gt;= 90 and &lt;= 100");
                        printf("\nTake Briefcase Number 4");
                        break;      
                   default:
                       printf("Not in the number range");
                       break;
  
                   }
        getch();
        }
  </code></pre>
  
  <p>My professor told us that there is a shorter way on how to do this but won't tell us how. The only way I can think of shortening it is by using IF but we are not allowed to. Any Ideas on how I can make this work out?</p>