title: Rounding up to the nearest multiple of a number
body: <p>OK - I'm almost embarrassed posting this here (and I will delete if anyone votes to close) as it seems like a basic question.</p>
  
  <p>Is this the correct way to round up to a multiple of a number in C++? </p>
  
  <p>I know there are other questions related to this but I am specficially interested to know what is the best way to do this in C++:</p>
  
  <pre><code>int roundUp(int numToRound, int multiple)
  {
   if(multiple == 0)
   {
    return numToRound;
   }
  
   int roundDown = ( (int) (numToRound) / multiple) * multiple;
   int roundUp = roundDown + multiple; 
   int roundCalc = roundUp;
   return (roundCalc);
  }
  </code></pre>
  
  <p>Update:
  Sorry I probably didn't make intention clear.  Here are some examples:</p>
  
  <pre><code>roundUp(7, 100)
  //return 100
  
  roundUp(117, 100)
  //return 200
  
  roundUp(477, 100)
  //return 500
  
  roundUp(1077, 100)
  //return 1100
  
  roundUp(52, 20)
  //return 60
  
  roundUp(74, 30)
  //return 90
  </code></pre>