Write a program to accept an integer amount from user and tell minimum number of notes needed for representing that amount.
banknote =[500,200,100,50,20,10,5,2,1]
result = 0
suma = float(input("Enter the amount you want to withdraw: "))
if suma > 0 and suma % banknote[-1] == 0:
for i in banknote:
print ( str(i) + "->" + str(suma//i))
result += suma//i
suma = suma%i
print ("Minimum number banknote = " + str(result))
else:
print ("Incorrect value")
Comments
Leave a comment