+ 11

# Can someone tell me the easiest code to find roots of a quadratic equation in c?

C

14 Answers

+ 9

If b**2-4ac is lesser than 0, what is the code and it's output

+ 8

Thanks Peter

+ 7

I want the code, sir!

+ 7

Yeah, lab program

+ 7

Anyway Thanks for your time,sir!

+ 6

I can do it. But little confusing..

+ 6

Somewhat, I understood the logic

+ 4

Use this formulas:
X1 = (-b+sqrt(b**2-4*a*c))/(2*a)
X2 = (-b-sqrt(b**2-4*a*c))/(2*a)

+ 4

Wow peter, good explanation it helps me too. I haven't learned this yet in school so i don't know so much

+ 3

ohh maths i think iâm allergic but try this on lol
b2-4ac is known as the discriminant of a quadratic equation. The discriminant tells the nature of the roots. If discriminant is greater than 0, the roots are real and different.
If the discriminant of a quadratic function is equal to zero, that function has exactly one real root and crosses the x-axis at a single point. To see this, we set b2 â4ac = 0 in the quadratic formula to get, is the x-coordinate of the vertex of a parabola?? something like that i feel old trying recall old maths. good luck hope the explanation helps the logic gates start working lol

+ 1

Just do the input and output for this, you can do it alone, can't you?
Also isn't this a homework or sth?

+ 1

And is it homework or what?

+ 1

Have you done anything yourself and you want correcting it or you want me (anyone other) to code it from scratch?
And is it too hard to do input, and output?