if a+b+c=0then the root are
Answers
Answered by
0
Answer:Given three integers a, b and c such that a + b + c = 0. The task is to find the roots of a quadratic equation ax2 + bx + c = 0.
Examples:
Input: a = 1, b = 2, c = -3
Output: 1, -3
Input: a = -5, b = 3, c = 2
Output: 1, -2.5
pproach: When a + b + c = 0 then the roots of the equation ax2 + bx + c = 0 are always 1 and c / a.
For example,
Take a = 3, b = 2 and c = -5 such that a + b + c = 0
Now, the equation will be 3x2 + 2x – 5 = 0
Solving for x,
3x2 + 5x – 3x – 5 = 0
x * (3x + 5) -1 * (3x + 5) = 0
(x – 1) * (3x + 5) = 0
x = 1, x = (-5 / 3) = (c / a)
Similar questions