Algebra equation in C++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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??

29th Jan 2020, 2:28 AM
CLEO
CLEO - avatar
2 Answers
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.
29th Jan 2020, 2:48 AM
Maninder $ingh
Maninder $ingh - avatar
0
1.0/x1 + 1.0/x2 =(1.0*x2+1.0*x1) / (x1*x2) =(x2+x1) /(x1*x2)
29th Jan 2020, 9:08 AM
Jayakrishna 🇮🇳