Answer to Question #221104 in Python for Dr Kiran Tummalapa

Question #221104

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-07-28T06:07:29-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}\n50: {1}\n10:{2}\n1: {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