title: Finding the last value of a sequence before a termination value C++
body: <p>In this loop, x is incremented one too many times.</p>
  
  <pre><code>int x = 0;
  while (x &lt; 10)
  {
      x = x + 3;
  }
  cout &lt;&lt; x;
  </code></pre>
  
  <p>The output for this is 12, when i want it to be 9. Generally speaking, how would I find the last value of a sequence (in this case 9)  given a restraint ( in this case 10). </p>