Please check whats the error its giving correct output but test cases are failing
this expression is wrong
root1=(-b+ pow(d,1/2))/2*a;
correct one
root1=(-b+ pow(d,1/2))/(2*a);
and instead of pow use sqrt()
if(d=0)
{
cout<<"Real and Equal"<<endl;
cout<<root1<<' '<<root2;
}
here you have to check d==0 (double equal to) not assignment operator(=)
Modified Code
but question shows that a,b,c should be in range [-100,100] what about this???
this is for your knowledge should not included in code
this is mention so that you can make your logic accordingly
it is given information you have to work accordingly
thankyou so much,clear now.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
plz give your feedback
it hardly takes a min