Computer Science, asked by vijayanand97, 1 year ago

You have x no. of 5 rupee coins and y no. of 1 rupee coins. you want to purchase an item for amount z. the shopkeeper wants you to provide exact change. you want to pay using minimum number of coins. how many 5 rupee coins and 1 rupee coins will you use? if exact change is not possible then display -1 in phyton

Answers

Answered by agammishra633
1

SOrry i don't know the answer..

Sorry

Answered by amilio0601
0

Answer:

Explanation:

def make_amount(rupees_to_make,no_of_five,no_of_one):

   five_needed=0

   one_needed=0

       

   five_needed = int(rupees_to_make / 5)

   one_needed = rupees_to_make % 5

   if (five_needed <= no_of_five and one_needed <= no_of_one):

       print("No. of Five needed :", five_needed)

       print("No. of One needed  :", one_needed)

   else:

       print(-1)

make_amount(28,8,5)

Similar questions