Computer Science, asked by nishixipearl, 1 month ago

Write a Python program to enter any money and find out number of
denominations can be used to make that money

Answers

Answered by anishpriya42
0

Answer:

int a[8]={500,100,50,20,10,5,2,1},m,temp,i;

printf("Enter the amount:");

scanf("%d",&m);

temp=m;

for(i=0;i<8;i++)

{

printf("\n%d notes is:%d",a[i],temp/a[i]);

More items...

Answered by samuveljebaraj30
0

Answer:

Given an amount, write a program to find a minimum number of currency notes of different denominations that sum to the given amount. Available note denominations are 1000, 500, 100, 50, 20, 5, 1.

For example, if the given amount is 8593, in this problem you have to give the minimum number of notes that sum up to the given amount. Since we only have notes with denomination 1000, 500, 100, 50, 20, 5 and 1, we can only use these notes.

1000:8

500:1

100:0

50:1

20:2

5:0

1:3

Explanation:

nominals = (1000, 500, 100, 50, 20, 5, 1)

amount = int(input('amount = '))

= {}

for n in nominals:

output[n] = amount // n

amount %= n

for k, v in output.items():

print(k, v, sep=':')

Similar questions