Denominations - 2
The possible denominations of currency notes are 100, 50, 20 and 10. The amount
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
100 Notes: 3
50 Notes: 1
20 Notes: 1
10 Notes: 0
A = int(input())
if A % 10 != 0:
raise ValueError('The number must be divisible by 10 without a remainder')
print('100 Notes:', A//100)
A -= A//100 * 100
print('50 Notes:', A//50)
A -= A//50 * 50
print('20 Notes:', A//20)
A -= A//20 * 20
print('10 Notes:', A//10)
Comments
Leave a comment