Answer to Question #234757 in Python for umesh

Question #234757

Denominations - 3

Write a program to find the minimum number of notes required for the amount

M. Available note denominations are 500, 50, 10, 1.Input

The first line is a single integer

M.Output

Print

M in denominaitons.Explanation

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


1
Expert's answer
2021-09-10T18:54:26-0400
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))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS