title: Explanation of C++ Code
body: <p>I'm currently working on a program that outputs the number 1089 (i.e the Magic Number) of a three digit integer who's first digit is greater than its last. I have some code typed up, but am not receiving 1089, instead I'm receiving 891. Could anyone offer some explanation as to why. </p>
  
  <pre><code> //Uses a cout to inform user will be using the number 412 as an example.
          //Uses a cout to explain to user the number needs to be reversed.
          cout &lt;&lt; "Alright, let's walk through an example, using the number 412." &lt;&lt; endl;
          int numExample = 412;
          cout &lt;&lt; "Please input 412" &lt;&lt; endl;
          cin &gt;&gt; numExample;
          cout &lt;&lt; "First, the number 412 is reversed." &lt;&lt; endl;
          //The following is done for reversing the number 412:
              int reverseNum = 0, remainder = 0;
              while (numExample)
              {
                  remainder = numExample % 10;
                  reverseNum = (reverseNum * 10) + remainder;
                  numExample = numExample / 10;
              }
                  cout &lt;&lt; "The reverse of 412 is " &lt;&lt; reverseNum &lt;&lt; endl;
          cout &lt;&lt; "Next, we want to subtract the reverse of the original number from its reverse" &lt;&lt; endl;
          cout &lt;&lt; "This gives us 198" &lt;&lt; endl;
          cout &lt;&lt; "From there, we want to reverse 198." &lt;&lt; endl;
          //The same procedure is used to reverse 198
          int numExample2 = 198;
          cout &lt;&lt; "Please enter 198" &lt;&lt; endl;
          cin &gt;&gt; numExample2;
              int reverseNum2 = 0, remainder2 = 0;
              while (numExample2)
              {
                  remainder2 = numExample2 % 10;
                  reverseNum2 = (reverseNum2 * 10) + remainder2;
                  numExample2 = numExample2 / 10;
              }
          cout &lt;&lt; "The reverse of 198 is " &lt;&lt; reverseNum2 &lt;&lt; endl;
          int magicNumber = (reverseNum2 + numExample2);
          cout &lt;&lt; "Following that, we want to add 891 to 189 which gives us " &lt;&lt; magicNumber &lt;&lt; endl;
  </code></pre>