Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from cs50 import get_float
- dollars = 0
- quarters = 0
- dimes = 0
- nickels = 0
- pennies = 0
- num = get_float("Cash owed")
- rnum = round(num*100)
- while rnum > 0:
- if rnum/25 >= 0:
- quarters = rnum/25
- rnum %= 25
- if rnum/10 >= 0:
- dimes = rnum/10
- rnum %= 10
- if rnum/5 >= 0:
- nickels = rnum/5
- rnum %= 5
- if rnum/1 >= 0:
- pennies = rnum/1
- rnum %= 1
- if rnum < 0:
- print("Please enter a positive number:")
- total = dimes + pennies + nickels + quarters
- #return total
- #return total
- print(total)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement