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
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Sum of two numbers if the original ratio and new ratio obtained by adding a given number to each number is given
- Find the number which when added to the given ratio a : b, the ratio changes to c : d
- Ratio of mth and nth terms of an A. P. with given ratio of sums
- Maximum items that can be bought with the given type of coins
- Count of binary strings of length N having equal count of 0's and 1's and count of 1's ≥ count of 0's in each prefix substring
- Find minimum number of coins that make a given value
- Program to find the Sum of each Row and each Column of a Matrix
- Max count of unique ratio/fraction pairs in given arrays
- Program to find the common ratio of three numbers
- Find out the minimum number of coins required to pay total amount
- Find if it is possible to get a ratio from given ranges of costs and quantities
- Find amount to be added to achieve target ratio in a given mixture
- Find the ratio of LCM to GCD of a given Array
- Check if given coins can be used to pay a value of S
- Generate a combination of minimum coins that sums to a given value
- Count the number of rectangles such that ratio of sides lies in the range [a,b]
- Program to calculate the profit sharing ratio
- Find nth Fibonacci number using Golden ratio
- Find speed of man from speed of stream and ratio of time with up and down streams
- Find the ratio of number of elements in two Arrays from their individual and combined average
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.