Can you check if this should be output : -
if (d == 0){
cout << “Real and Equal” << endl;
cout << -1*(b/2a);
}
else if (d>0){
cout << “Real and Distinct” << endl;
cout << ((-b+sqrt(d))/2a) << " " << ((-b-sqrt(d)/2*a));
}
else if(d<0) {
cout << “Imaginary” << endl;
}
My code is absolutely right still it is showing 2 test case fisl
Plz send your complete code by saving on ide
Your code is not working correct with sample test case, plz use correct formulaes for calculating determinants and roots, Kindly use these formulaes
det=sqrt(bb-4a*c);
r1=(-b+det)/2*a;
r2=(-b-det)/2*a;
and then you can check if r1==r2, then you have real and equal roots, or if r1!=r2, then you have real and distinct roots, or if det<0, then imaginary roots.