Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
C++ program to find ΔX which is added to numerator and denominator both of fraction (a/b) to convert it to another fraction (c/d)
In this article, we will be discussing a program to find ΔX which is added to the numerator and denominator both of given fraction (a/b) to convert it to another given irreducible fraction (c/d).
For example, let us suppose we have been given with the following values,
a = 4 | b = 2 | c = 4 | d = 3
then ΔX would be 4 such that (a + ΔX)/(b + ΔX) = 8/6 = 2/3
As we know, (a + ΔX)/(b + ΔX) = c/d. Solving this equation for ΔX, we get
ΔX = (bc - ad) / (d - c)
Example
#include <iostream>
using namespace std;
int main() {
int a = 4;
int b = 2;
int c = 4;
int d = 3;
int dif = 0;
dif = (b*c-a*d)/(d-c);
cout << "The value of \u0394x :" << endl;
cout << dif << endl;
return 0;
}
Output
The value of Δx : 4
Advertisements
