DiYane

*Coins* 5/10

Aug 12th, 2021
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. money_change = int(float(input()) * 100)
  2. num_of_coins = 0
  3.  
  4. while money_change > 0:
  5.     num_of_coins += 1
  6.  
  7.     if money_change >= 200:
  8.         money_change -= 200
  9.  
  10.     elif money_change >= 100:
  11.         money_change -= 100
  12.  
  13.     elif money_change >= 50:
  14.         money_change -= 50
  15.  
  16.     elif money_change >= 20:
  17.         money_change -= 20
  18.  
  19.     elif money_change >= 10:
  20.         money_change -= 10
  21.  
  22.     elif money_change >= 5:
  23.         money_change -= 5
  24.  
  25.     elif money_change >= 2:
  26.         money_change -= 2
  27.  
  28.     elif money_change >= 1:
  29.         money_change -= 1
  30.  
  31. print(num_of_coins)
Advertisement
Add Comment
Please, Sign In to add comment