+ 11

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

C

10th Feb 2019, 4:36 PM
Sharon Shelton
Sharon Shelton - avatar
14 Answers
+ 9
If b**2-4ac is lesser than 0, what is the code and it's output
10th Feb 2019, 5:28 PM
Sharon Shelton
Sharon Shelton - avatar
+ 8
Thanks Peter
10th Feb 2019, 5:48 PM
Sharon Shelton
Sharon Shelton - avatar
+ 7
I want the code, sir!
10th Feb 2019, 5:05 PM
Sharon Shelton
Sharon Shelton - avatar
+ 7
Yeah, lab program
10th Feb 2019, 5:23 PM
Sharon Shelton
Sharon Shelton - avatar
+ 7
Anyway Thanks for your time,sir!
10th Feb 2019, 5:44 PM
Sharon Shelton
Sharon Shelton - avatar
+ 6
I can do it. But little confusing..
10th Feb 2019, 5:09 PM
Sharon Shelton
Sharon Shelton - avatar
+ 6
Somewhat, I understood the logic
10th Feb 2019, 5:45 PM
Sharon Shelton
Sharon Shelton - avatar
+ 4
Use this formulas: X1 = (-b+sqrt(b**2-4*a*c))/(2*a) X2 = (-b-sqrt(b**2-4*a*c))/(2*a)
10th Feb 2019, 4:50 PM
Maneren
Maneren - avatar
+ 4
Wow peter, good explanation it helps me too. I haven't learned this yet in school so i don't know so much
10th Feb 2019, 5:50 PM
Maneren
Maneren - avatar
+ 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
10th Feb 2019, 5:47 PM
peter
peter - avatar
+ 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?
10th Feb 2019, 5:06 PM
Maneren
Maneren - avatar
+ 1
And is it homework or what?
10th Feb 2019, 5:14 PM
Maneren
Maneren - avatar
+ 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?
10th Feb 2019, 5:24 PM
Maneren
Maneren - avatar
30th Jan 2023, 9:53 PM
Kingdavid Christian
Kingdavid Christian - avatar