title: If the sum of any of the remainders is odd then add 11 *unless* adding 11 causes
body: <p>I'm having a new issue. 
  The goal of this program is to end up with the same A,B,C values the user started with. My code works for just about every 3 digit integer except for a few, like 984 and 985 for example. The "new value of A and B " comes out to multiples of 9 and 8 like 3 and 2 instead of 9 and 8 (like it should.)</p>
  
  <p>I've commented where the problem starts. It's my new attempt and my first attempt at the code. Thanks in advance. </p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  int main(int argc, char *argv[]) {
  
      //declare each variable
      int A,B,C;
      int ABC, BCA, CAB;
      int X,Y,Z; //remainders stored
      int P,Q,R; //sums of remainders
  
      //welcome
      cout&lt;&lt; "Welcome to Acelia's 3 digit reader \n"
          &lt;&lt;"\n";
  
      //prompt user
      cout &lt;&lt; "Enter a number between 100 and 999: "; 
          cin &gt;&gt; ABC;
  
      //fits in range
      while ( (ABC &lt; 100) || (ABC &gt; 999) ) {
          cout &lt;&lt; "Enter a valid number between 100 and 999: ";
          cin &gt;&gt; ABC;
      }
  
      cout &lt;&lt; "Cool, you entered " &lt;&lt; ABC 
           &lt;&lt;".\n"
           &lt;&lt;"\nIn the form of ABC...\n";
  
      //strip each digit of the number
      A = (ABC / 100);
      B = ((ABC/10) % 10);
      C = (ABC % 10);
  
  
      BCA = (B * 100 + C * 10 +A); //hundreds, tens, ones
      CAB = (C * 100 + A * 10 +B);
      cout &lt;&lt;"A is "&lt;&lt; A&lt;&lt; "\nB is " &lt;&lt; B&lt;&lt;"\nC is " &lt;&lt; C &lt;&lt;"\n"; //print individual #
  
      //print ABC, BCA, CAB
      cout &lt;&lt;"\nYour number in the form ABC is " &lt;&lt; ABC
           &lt;&lt;"\nYour number in the form BCA is " &lt;&lt; BCA
           &lt;&lt;"\nYour number in the form CAB is " &lt;&lt; CAB
           &lt;&lt; "\n\n";
  
      //store remainder of each value when divided by 11
      X = (ABC % 11); cout&lt;&lt; "The remainder of " &lt;&lt; ABC &lt;&lt;" divided by 11 is " &lt;&lt; X;
      Y = (BCA % 11); cout&lt;&lt; "\nThe remainder of " &lt;&lt; BCA &lt;&lt;" divided by 11 is " &lt;&lt; Y;
      Z = (CAB % 11); cout&lt;&lt; "\nThe remainder of " &lt;&lt; CAB &lt;&lt;" divided by 11 is " &lt;&lt; Z &lt;&lt; "\n\n";
  
      //sums of each remainder
      P = (X + Y); cout&lt;&lt; "The sum of remainders from ABC and BCA is: " &lt;&lt; P;
      Q = (Y + Z); cout&lt;&lt; "\nThe sum of remainders from BCA and CAB is: " &lt;&lt; Q;
      R = (Z + X); cout&lt;&lt; "\nThe sum of remainders from CAB and ABC is: " &lt;&lt; R &lt;&lt;"\n\n";
  
      int newP=0; //it would not execute properly w/o being initialized to 0
      int newQ=0;
      int newR=0;
  
      // Check sum remainder of X &amp; Y 
      /*!!!!!!PROBLEM IS HERE!!!!!*/
      if (P % 2 == 1){
  
          if(P + 11 &gt; 20) {
              newP = (P-11);
  
          }
          else {
              newP = (P+11);
          }
  
      }
  
      newP = (P/2);
      cout &lt;&lt; "\nNew value of A is: " &lt;&lt; newP; 
  
      //check sum remainder of Y &amp; Z 
      /*ORIGNAL CODE */
      if ((Q % 2 == 1) &amp;&amp; ((Q+11) &gt; 20)){
              newQ = (Q-11);
              newQ = (newQ/2);
              cout&lt;&lt; ("\nNew value of B is: ") &lt;&lt; newQ &lt;&lt; "\n";
              if ((Q % 2 == 1) &amp;&amp; ((Q + 11) &lt; 20)) {
                  newQ = (Q+11);
                  newQ = (newQ /2);
                  cout&lt;&lt; ("\nNew value of B is: ") &lt;&lt; newQ &lt;&lt; "\n";
              }
          }
          else {
              newQ = (Q/2);
              cout &lt;&lt; "\nNew value of B is: " &lt;&lt; newQ; 
          }
  
  
      //check sum remainder of Z + X
      if ((R % 2 == 1) &amp;&amp; ((R+11) &gt; 20)){
              newR = (R-11);
              newR = (newR/2);
              cout&lt;&lt; ("\nNew value of C is: ") &lt;&lt; newR &lt;&lt; "\n";
              if ((R % 2 == 1) &amp;&amp; ((R + 11) &lt; 20)) {
                  newR = (R+11);
                  newR = (newR /2);
                  cout&lt;&lt; ("\nNew value of C is: ") &lt;&lt; newR &lt;&lt; "\n";
              }
          }
          else {
              newR = (R/2);
              cout &lt;&lt; "\nNew value of C is: " &lt;&lt; newR; 
          }
  
  }//end of main
  </code></pre>