title: Java Beginner - Mistake on a simple code
body: <p>is my first time here so i dont know exactly how it works, so sorry for the mistakes.</p>
  
  <p>What's the result from this function, when we give as "aktueller Parameter" the number 3?</p>
  
  <p>(The original text: </p>
  
  <p>Welches Ergebnis liefert diese Methode, wenn bei einem Aufruf als aktueller Parameter
  der Wert 3 übergeben wird?</p>
  
  <p>Im studying in German, so i dont really know the english terms  :/ )</p>
  
  <pre><code>public int m(int p)
  {
     int result;
     if (p == 0)
     {
      result = 0;
     }
     else
     {
      result = 3*p + m(p-1);
     }
      return result;
     }
  </code></pre>
  
  <p>I have already tried it and the answer is 18, but when im trying to do it without any program the answer i find is 15:</p>
  
  <pre><code>result = 3 * 3 + 3(3-1);
  </code></pre>
  
  <p><strong>Can someone please explain me why is 18 and not 15?</strong> Im assuming that i am making something wrong.</p>
  
  <p>Thank you in advance.</p>