title: Coin change algorithm
body: <p>would just like to double check this code will not have any errors, mainly to do with the modulus operator I'm unsure about.</p>
  
  <p>The question is:</p>
  
  <p>Problem: Write an ACL algorithm that, given a cost of an item (less than or equal to one dollar), gives the number of 50 cent, 20 cent, 10 cent, 5 cent and 1 cent coins the buyer would receive if they handed over one dollar. You must minimise the number of coins in the change. </p>
  
  <p>My solution is:</p>
  
  <pre><code>Algorithm coin_change
  {
      int cost, change, fifty, twenty, ten, five, one;
      read(cost);
      change = 100 - cost;
  
      fifty = change / 50;
      change = change % 50;
  
      twenty = change / 20;
      change = change % 20;
  
      ten = change / 10;
      change = change % 10;
  
      five = change / 5;
      change = change % 5;
  
      one = change;
  
      print(fifty, twenty, ten, five, one);
  }
  </code></pre>
  
  <p>Main thing I'm unsure about is for instance if the change is 93 cents, this will change to 43 cents, then down to 3 cents. Now question is will "<code>change = change % 10</code>" when change is 3 cents return change to equal 3 still? Hope that made sense. </p>
  
  <p>Thanks in advance.</p>