+ 1
Algebra equation in C++
I'm making a program where I used the equation:: (1/(1.0/×1)+(1.0/x2)) //the x are user input numbers Anybody know how I can rearrange that equation with just one divide and one multiply??
2 odpowiedzi
0
This is simple math. Take the LCM of both of the denominators and then solve the equation.
e.g
2/4+3/8 = 4+3/8 = 7/8
Here LCM of 4 and 8 is 8.then I solve it using simple algebra.
0
1.0/x1 + 1.0/x2
=(1.0*x2+1.0*x1) / (x1*x2)
=(x2+x1) /(x1*x2)