Answer to Question #228836 in Python for kaavya

Question #228836

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

Sample Input 1

1543

Sample Output 1

500: 3 50: 0 10: 4 1: 3

Sample Input 2

1259

Sample Output 2

500: 2 50: 5 10: 0 1: 9




1
Expert's answer
2021-08-26T18:31:12-0400
n = int(input())
print(f'500: {n // 500}', end=' ')
n = n % 500
print(f'50: {n // 50}', end=' ')
n = n % 50
print(f'10: {n // 10} 1: {n % 10}')

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