Advertisement
relax4o

greedy

Feb 18th, 2017
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.27 KB | None | 0 0
  1. while ( change > 0 ) {
  2.     if ( change >= 25 ) {
  3.         change -= 25;
  4.     } else if ( change >= 10 && change < 25 ) {
  5.         change -= 10;
  6.     } else if ( change >= 5 && change < 10 ) {
  7.         change -= 5;
  8.     } else {
  9.         change -= 1;
  10.     }
  11.     coins++;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement