Given a:b and b:c. The task is to write a program to find ratio a:b:c
Input: a:b = 2:3, b:c = 3:4 Output: 2:3:4 Input: a:b = 3:4, b:c = 8:9 Output: 6:8:9
Approach: The trick is to make the common term ‘b’ equal in both ratios. Therefore, multiply the first ratio by b2 (b term of second ratio) and the second ratio by b1.
Given: a:b1 and b2:c
Solution: a:b:c = (a*b2):(b1*b2):(c*b1)
If a : b = 5 : 9 and b : c = 7 : 4, then find a : b : c.
Here, Make the common term ‘b’ equal in both ratios.
Therefore, multiply the first ratio by 7 and the second ratio by 9.
So, a : b = 35 : 63 and b : c = 63 : 36
Thus, a : b : c = 35 : 63 : 36
Below is the implementation of 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.
- Sum of two numbers if the original ratio and new ratio obtained by adding a given number to each number is given
- Ratio of mth and nth terms of an A. P. with given ratio of sums
- Find ratio of zeroes, positive numbers and negative numbers in the Array
- C program to Find the Largest Number Among Three Numbers
- Program to find the count of coins of each type from the given ratio
- Check whether two numbers are in silver ratio
- Program to calculate the profit sharing ratio
- Find if it is possible to get a ratio from given ranges of costs and quantities
- Find speed of man from speed of stream and ratio of time with up and down streams
- Find amount to be added to achieve target ratio in a given mixture
- Find the ratio of LCM to GCD of a given Array
- Program to find the smallest element among three elements
- Swap three numbers in cycle
- Count of ways to write N as a sum of three numbers
- Product of Complex Numbers using three Multiplication Operation
- QA - Placement Quizzes | Ratio and Proportion | Question 1
- QA - Placement Quizzes | Ratio and Proportion | Question 2
- QA - Placement Quizzes | Ratio and Proportion | Question 3
- QA - Placement Quizzes | Ratio and Proportion | Question 4
- QA - Placement Quizzes | Ratio and Proportion | Question 5
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.