title: Switch vs if ... else if ... else
body: <p>I have a question. I'm studying for my exam and I don't know how to do answer this. Basically I have to change the instructions if...else if... else, to a instruction switch in order that the output of the program stays the same.</p>
  
  <pre><code>void main()
  {
      int x;
      x = 1;
      for (int i = 1; i &lt; 10; ++i) {
          if (i &lt;= 3)
              do {
                  x += i;
                  if (x &gt;= 4)
                      break;
              } while (i % 2 == 0);
          else if ((i &gt; 3) &amp;&amp; (i &lt; 5))
              x += 2;
          else
              continue;
      }
      while (x &gt; 0) {
          printf(" x=%d ", x);
          x -= 1;
      }
      system("pause");
  }
  </code></pre>
  
  <p>Am I allowed to do a switch inside of the for loop? </p>