Write a program to find the ratio in which a shopkeeper will mix two types of rice worth Rs. kg and Rs. kg, so that the average cost of the mixture is Rs. kg.
Input : X = 50, Y = 70, Z = 65 Output : Ratio = 1:3 Input : X = 1000, Y = 2000, Z = 1400 Output : Ratio = 3:2
According to Alligation rule, the ratio of the weights of two items mixed will be inversely proportional to the deviation of attributes of these two items from the average attribute of the resultant mixture.
w1 / w2 = (d - m) / (m - c)
Below program illustrate the above approach:
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.
- Solve the Logical Expression given by string
- How to solve RSA Algorithm Problems?
- Some Tricks to solve problems on Impartial games
- Shortest Superstring Problem | Set 2 (Using Set Cover)
- Josephus problem | Set 2 (A Simple Solution when k = 2)
- Word Break Problem | DP-32 | Set - 2
- Exact Cover Problem and Algorithm X | Set 1
- Exact Cover Problem and Algorithm X | Set 2 (Implementation with DLX)
- Maths behind number of paths in matrix problem
- Problem of 8 Neighbours of an element in a 2-D Matrix
- Fibonacci problem (Value of Fib(N)*Fib(N) - Fib(N-1) * Fib(N+1))
- Travelling Salesman Problem implementation using BackTracking
- Twisted Tower of Hanoi Problem
- Widest Path Problem | Practical application of Dijkstra's Algorithm
- Problem in comparing Floating point numbers and how to compare them correctly?
- Maximal Clique Problem | Recursive Solution
- Equivalence Class Testing- Next date problem
- Boundary Value Analysis - Triangle Problem
- Traveling Salesman Problem using Genetic Algorithm
- Shortest Path Problem Between Routing Terminals - Implementation in Python
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.