Denominations - 2
The possible denominations of currency notes are 100, 50, 20 and 10. The amount
The first line of input is an integer A.
The output should be a string representing number of 100, 50, 20, 10 notes possible.
In the given example amount
370, it can be written as370 = 3*(100) + 1*(50) + 1*(20) + 0*(10)Then the output should be
number= int(input("Enter integer A: "))
if number % 10 != 0:
raise ValueError('Invalid number. \The number must be a multiple of 10')
print('100 Notes:', number//100)
number -= number//100 * 100
print('50 Notes:', number//50)
number -= number//50 * 50
print('20 Notes:', number//20)
number -= number//20 * 20
print('10 Notes:', number//10)
Comments
Leave a comment