Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C program for the following problem. Given denomination d1, d2, d3, ... dn and an amount M, how can one pay the amount

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Organizing Information Digital And Information Literacy

Authors: Greg Roza

1st Edition

1448805929, 978-1448805921

More Books

Students also viewed these Databases questions

Question

7. Discuss the key features of the learning organization.

Answered: 1 week ago