Denominations - 3
Write a program to find the minimum number of notes required for the amount
The first line is a single integer
Given
M = 1543, it can be written as1543 = 3*(500) + 3*(50) + 0*(10) + 1*(3)Then the output should be
500: 3 50: 0 10: 4 1: 3
N = int(input())
N_500 = N // 500
N %= 500
N_50 = N // 50
N %= 50
N_10 = N // 10
N %= 10
print('500: {0}\t50: {1}\t10:{2}\t1: {3}'.format(N_500,N_50,N_10,N))
Comments
Leave a comment