Question: Write a C program for the following problem. Given denomination d1, d2, d3, ... dn and an amount M, how can one pay the amount
Write a C program for the following problem. Given denomination d1, d2, d3, ... dn and an amount M, how can one pay the amount Musing the given denominations using minimum number of coins. Apply Greedy strategy. For example, Input: coin[] = {25,20,10,5), M=50 Output: Total coins = 2 (25+25) Input: coin() = (25,20,10,5), M = 70 Output: Total coins needed = 3 (25+25+20). Note: Read how many coins, denominations of coins and amount (M) to be paid from the user. Print the total coins needed and their denominations in the specified format. For example: Input Result 4 2 25 20 10 5 25+25 50 4 25 20 10 5 70 3 25+25+20
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
