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

Quadratic equation

I tried it.. but the answers end up incorrect... I need help please

1st Jul 2017, 7:28 PM
Esiro Davies
Esiro Davies - avatar
11 Answers
2nd Jul 2017, 3:18 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 5
can you post the code
29th Jun 2017, 7:45 AM
johan beimers
johan beimers - avatar
+ 3
this is what i did #include <iostream> #include <cmath> using namespace std; int main() { int a, b , c float x1; float x2; cout<< "Enter the a" << endl; cin >> a; cout << "Enter b" << endl; cin >> b; cout << "Enter c" << endl; cin >> c; cout << "Your a, b and c is " << a << b << c << "Respectively"<< endl; x1 = (b*b) - sqrt( (b*b) - (2*a*c) / (2*a) x2 = (b*b) + sqrt( (b*b) - (2*a*c) / (2*a) cout << "The first root of the quadratic equation is " << x1 << endl; cout << "The second root of the quadratic equation is "<< x2 << endl; return 0; }
1st Jul 2017, 7:29 PM
Esiro Davies
Esiro Davies - avatar
1st Jul 2017, 7:48 PM
‎ ‏‏‎Anonymous Guy
+ 2
Well, I would love to help but I need to know the problem exactly. Any code or anything lol?
29th Jun 2017, 6:05 AM
Don
Don - avatar
+ 2
quadratic equation formula (-b +-√b^2 - 4ac ) / 2a now in your code whats that b*b in the beginning
1st Jul 2017, 7:35 PM
‎ ‏‏‎Anonymous Guy
+ 2
Can we generalise to an n-power polynamial, like quintic, ^6, ^7, etcm
2nd Jul 2017, 4:01 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 1
1st Jul 2017, 7:56 PM
‎ ‏‏‎Anonymous Guy
+ 1
This is my code in Ruby: https://code.sololearn.com/cW0jVY8ZNM42/#rb Maybe something help
1st Jul 2017, 8:06 PM
Jakub Miziński
Jakub Miziński - avatar
0
well that will get way too complicated.
2nd Jul 2017, 4:36 AM
‎ ‏‏‎Anonymous Guy
0
@$Vengat you can use this to find root of any form of equation. But only one root. https://code.sololearn.com/cUSS7rcnePZ1/?ref=app
3rd Jul 2017, 5:40 AM
Ahmad Fahadh Ilyas
Ahmad Fahadh Ilyas - avatar