0

((You often need to convert Rupees into coins of 5, 2, and 1. You task is to develop a C++ program to compute a mix of coins of 5, 2 and 1 against the given amount of money. Remember that you may not always have enough coins. So the program should be able to covert the money into the coins available. For example, if you don’t have the coins of 5-rupees, then for 7 rupees the program should compute a mix of 2-rupees and 1-rupee coins. The program should also take as input the number of 5-rupees, 2-rupees and 1-rupee coins available. The program should display the amount of money in terms of numbers of 5-rupees coins, 2-rupees coins and 1-rupee coins if possible with the available set of coins. Otherwise print the message “Sorry!! No such combination exists".))
please someone can help me solving this without using arrays.

2
Contributors
1
Reply
23
Views
10 Months
Discussion Span
Last Post by tinstaafl
2

Start by thinking of how you would do this in the real world.

You know how much your target amount is, so you start with the highest available denomination.

Count until you equal the target, one more would go over, or you've run out of that denomination.

Move on to the next denomination, adding to the previous total, and so on. Keeping track of how many of each coin you've used.

If you run out of coins before you reach the target then you send the error message.

When you have code that tries this but doesn't work, we will be more than happy to give you more help.

Votes + Comments
The Count is glad.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.