Wrong Test Case

Failing of test case 1
#include
#include
using namespace std;
int main() {
int a,b,c,d;
float x1,x2,x;
cin>>a>>b>>c;
d = (bb)-4ac;
x1 = (-b+sqrt(d))/(2
a);
x2 = (-b-sqrt(d))/(2*a);
if(d==0)
{
cout<<“Real and Equal”<<endl;
cout<<x1;
}
else
if(d>0)
{
cout<<“Real and Distinct”<<endl;
if(x1>x2)
cout<<x2<<" “<<x1;
else
cout<<x1<<” "<<x2;
}
else
{
cout<<“Imaginary”;
}
return 0;
}
When in your solutions which I’ve seen it’s having the same answer but its not passing my test case at compiler.

Hey @chirag.goel360
Print equal root twice not once.
If your doubt is resolve please mark it as cleared.

Sir it is showing error in test case 1
Test case input is 111
Output is imaginary buy when i run on compile and test it show me correct ans as imaginary but when i submit code it says test case 1 fail

Your code is failing test 1 -8 16. You’re printing root once. Print equal root twice. Ordering of questions in evaluation is different from order of test cases.

Bro if roots are equal then you have to print it once only
My test case is failing in
111 as input according to coding blocks compiler

Try to run the code in the question and check the test case 1 will fail which is 1 1 1
Output is imaginary


See roots printed twice. Correct answer. Please do it.

If your doubt is resolved please mark it as closed.

Already marked closed in my course

1 Like

1 Like

Great. Thanks buddy. Best of luck !!

1 Like

Thank you for helping :blush:

1 Like