input 3 coefficients of a quadratic equation and find the roots | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

input 3 coefficients of a quadratic equation and find the roots

18th Jan 2018, 9:00 AM
The Reason Why
The Reason Why - avatar
3 Answers
+ 11
int d=(pow(cb,z)-(4*a*c)); int ad=sqrt(d); if(ad<0) cout<<"No Real Roots"; cout<<End;!; elseif First of all, you need to use the multiplication operator to do multiplication (surprise!). cb is not equals to c*b (if that is what you are trying to do). You also did not declare variable z. You have to put quotes around End to make it a string. There is no such thing as elseif, but there is else if (separated by a whitespace). However, you only need an else statement, because you don't plan to state another condition. In your else block, sol1 and sol2 should be used as how they are declared (without a whitespace in between sol and the number following it).
18th Jan 2018, 9:47 AM
Hatsy Rei
Hatsy Rei - avatar
+ 9
I'm assuming this is whatever you've tried: https://code.sololearn.com/cto7oT7724yl/?ref=app
18th Jan 2018, 9:44 AM
Hatsy Rei
Hatsy Rei - avatar
0
Please help idk
18th Jan 2018, 9:00 AM
The Reason Why
The Reason Why - avatar