title: How to determine, which one is faster and takes less memory?
body: <p><strong>Case 1 :</strong></p>
  
  <pre><code>int fun(int num)
  {
      if (num == 1)
          return 1;
      else
          return num * fun(num - 1);
  }
  </code></pre>
  
  <p><strong>Case 2:</strong></p>
  
  <pre><code>int fun(int num)
  {
      int i = 1;
      do
      {
          i = i * num;
          num--;
      }
      while (num);
      return i;
  }
  </code></pre>
  
  <p>I got the above question in interview question and asking about, which one is faster and take less memory. I really don't know, how to find, which one is faster except I was just guessing by just counting the line of code. But, I think, it is not a correct way.
  Please anyone help me, what should I consider to solve this type of question.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I'm asking for general case not ONLY for the above scenario.</p>