Algorithms | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Algorithms

Algorithm that will calculate the root a quadratic equation.

19th Mar 2019, 10:53 AM
Kcee
Kcee - avatar
4 Answers
+ 1
Total how many algorithms are there in computer science?
20th Nov 2019, 11:20 AM
DEEPIKA K. TIWARI
DEEPIKA K. TIWARI - avatar
+ 11
You can use the quadratic formula x = (-b ± √(b²-4ac)) / 2a The implementation via programming languages should be pretty straightforward. https://en.m.wikipedia.org/wiki/Quadratic_equation
19th Mar 2019, 11:02 AM
Hatsy Rei
Hatsy Rei - avatar
+ 6
If you only want real (non complex) roots, first check that the discriminant (b^2-4ac) is not negative.
19th Mar 2019, 12:21 PM
Sonic
Sonic - avatar
+ 3
Kcee if you need to build a algorithm that will solve quadratics then you can check out this code I have build a algorithms that does it by completing the Squares https://code.sololearn.com/Wj1ruHhSVhw0/?ref=app
19th Mar 2019, 5:30 PM
George S Mulbah II
George S Mulbah II - avatar