title: How do I use modulo arithmetic to implement caesar cipher
body: <p>I am trying to perform a wrap around of the ASCII alphabet characters in order to perform a shift from a key. For example, if the key is 2 then shift the letter <code>A</code> to become <code>C</code>. But, how do I wrap around <code>Z</code> in order to get to <code>B</code> using modulus arithmetic?</p>
  
  <p>I am trying to implement the following formula:</p>
  
  <pre><code>ci = (pi + key) % 26;
  </code></pre>
  
  <p>Where <code>ci</code> is the <code>i</code>th ciphered letter and <code>pi</code> is the <code>i</code>th letter to be ciphered.</p>