Advertisement
Guest User

Untitled

a guest
Oct 1st, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. PRICE=123.45
  4. PAID=1300.0
  5.  
  6. change=PAID-PRICE
  7.  
  8. # Find largest denomination
  9. c=-3
  10. while True:
  11.     if int(change/pow(10,c)) == 0:
  12.         break
  13.     c += 1
  14.  
  15. while change>0:
  16.     c-=1
  17.     denomination = pow(10,c)
  18.     bills = int(change/denomination)
  19.     print "%d-%fs" % (bills,denomination)
  20.     change -= bills*denomination
  21.     change = round(change,2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement