Answer to Question #221289 in Python for Dr Kiran Tummalapa

Question #221289

Denominations - 2

The possible denominations of currency notes are 100, 50, 20 and 10. The amount

A to be withdrawn is given as input. Write a program to break the amount into minimum number of bank notes.InputThe first line of input is an integer A.Output

The output should be a string representing number of 100, 50, 20, 10 notes possible.

Explanation

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




1
Expert's answer
2021-07-31T07:17:08-0400
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)

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
APPROVED BY CLIENTS