Given the total number of Rupees in a bag and the ratio of coins. The bag contains only 1 Rs, 50 paise, 25 paise coins in X, Y, Z, ratio. The task is to determine the number of 1 Rs coins, 50 Paise coins, and 25 paise coins So that after summation of all these we again get the total rupees given.
Input: totalRupees = 1800, X = 1, Y = 2, Z = 4 Output: 1 rupees coins = 600 50 paisa coins = 1200 25 paisa coins = 2400 Input: totalRupees = 2500, X = 2, Y = 4, Z = 2 Output: 1 rupees coins = 555 50 paisa coins = 1110 25 paisa coins = 2220
Let the ratio in which 1 Rs, 50 paise and 25 paise coin is divided is 1:2:4
1 Rs coins in a bag is 1x.
50 paise coins in a bag is 2x.
25 paise coins in a bag is 4x.
Now convert these paise into Rupees.
x coins of 1 Rs each, the total value is x rupees.
2x coins of 50 paise i.e (1 / 2) rupees each, the total value is x rupees.
4x coins of 25 paise i.e (1 / 4) rupees each, the total is x rupees.
3x = 1800
x = 600
1 rupess coins = 600 * 1 = 600
50 paisa coins = 600 * 2 = 1200
25 paisa coins = 600 * 4 = 2400
Below is the implementation of the above approach:
1 rupess coins = 600 50 paisa coins = 1200 25 paisa coins = 2400
- Program to find the common ratio of three numbers
- Maximum items that can be bought with the given type of coins
- Find the number which when added to the given ratio a : b, the ratio changes to c : d
- Program to find out the data type of user input
- Count the number of rectangles such that ratio of sides lies in the range [a,b]
- Program to calculate the profit sharing ratio
- Find minimum number of coins that make a given value
- Find out the minimum number of coins required to pay total amount
- Find nth Fibonacci number using Golden ratio
- Find if it is possible to get a ratio from given ranges of costs and quantities
- Ratio of mth and nth terms of an A. P. with given ratio of sums
- Find amount to be added to achieve target ratio in a given mixture
- Program to find count of numbers having odd number of divisors in given range
- Find the ratio of number of elements in two Arrays from their individual and combined average
- Sum of two numbers if the original ratio and new ratio obtained by adding a given number to each number is given
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.