title: int array with int variable multiplication gives wrong result c++
body: <p>I'm learning c++ of my own, and I thought: "Where can I find some problems to solve?"... well, reading in stackoverflow I get interested in euler project, and here I am.</p>
  
  <p>I'm doing the 4th problem (not asking for help BTW), but I have a very strange issue...</p>
  
  <p>In this code, I want to separate a number in "digits"... that way I can say: if the first digit of the number is equal to the last, it is a palindrome number (number that can be read left to right or right to left an will be the same number... example: 90009). </p>
  
  <p>All good, but the problem is when I try to divide an array element into a power...
  for example:</p>
  
  <p>90009/power(10,4)=9 right? (using integers of course)...
  Well, code assigns the 9 to arregloDeNumero[4], and then </p>
  
  <p>arregloDeNumero[4]*pow(10,4)= 89999  :O :O ??????????
  it has to be 90000 right?? </p>
  
  <p>in addition, I put some cout&lt;&lt; code, if u want to run this function and see how it works in my mind :P</p>
  
  <p>but my question is: is there some bad code wrote by me or is some kind of bug or lack of knowledge?</p>
  
  <pre><code>void verificarPalindromo(int x)
  {
  
      int arregloDeNumero[6];
      int diferencia=0;
  
      for (int i=5;i&gt;=0;i--){
  
          cout &lt;&lt; "the number X is: " &lt;&lt; x; 
          cout &lt;&lt; "and the difference is: " &lt;&lt; diferencia &lt;&lt; endl;
  
          arregloDeNumero[i]= ((x-diferencia)/pow(10,i));
  
          cout &lt;&lt; "array of i= " &lt;&lt; i &lt;&lt; "is: " &lt;&lt; arregloDeNumero[i];
          cout &lt;&lt; " and the difference is: " &lt;&lt; diferencia &lt;&lt; endl;
  
          diferencia+=(arregloDeNumero[i]*pow(10,i));
  
          cout &lt;&lt; "the new difference is: " &lt;&lt; diferencia &lt;&lt; endl;
  
      }
  
  }
  </code></pre>