title: Function returns result lesser by 1 than it should be
body: <p>I'm trying to write an octal to decimal conversion app.</p>
  <p>The problem is the return value is 1 less than it should be, ex.:</p>
  <blockquote>
  <p>INPUT: 2426 (OCT)</p>
  <p>SHOULD RETURN: 1302 (DEC)</p>
  <p>RETURNS: 1301 (DEC)</p>
  </blockquote>
  <p>Any ideas what's wrong? I'm using newest Code::Blocks if someone wants to know.</p>
  <p>Here's my code:</p>
  <pre><code>int oct2dec (int number) {
      int system  = 8;
      int length  = IntegerLength(number);
      int power   = length - 1;
      int result  = 0;
      int partial = 0;
  
      do {
          partial = part_nr(number);
          cout&lt;&lt;&quot;czastka: &quot;&lt;&lt;partial&lt;&lt;endl;
          result = result + (partial * pow(system,power));
          number = number - (partial * pow(10,power));
          power--;
  
      } while (number&gt;0);
      return result; 
  }
  </code></pre>
  <p>part_nr function:</p>
  <pre><code>int part_nr(int number) {
      int multipler = 1;
      int result    = 0;
      do {
          int temp=number/multipler;
          if(temp&lt;10) result = temp;
          multipler = multipler*10;
      } while (result == 0);
      return result;
  }
  </code></pre>
  <p>IntegerLength function:</p>
  <pre><code>int IntegerLength(int value) {
     int divisor = 10;
     int length  = 1;
     while(value &gt;= divisor)
     {
       value = (value - (value % divisor)) / divisor;
       length ++;
     }
  
     return length;
  }
  </code></pre>
  <p>(btw. I've translated variables from my native lang to english, so if you see any non-eng variable say so, i'll correct it)</p>