Roots of quadratic equation

my code is not passing all the testcases

#include
#include<math.h>
using namespace std;

int main() {
float a,b,c,d,x1,x2;
cin>>a>>b>>c;
d=(pow(b,2))-(4ac);

if(d>0){
    x1=(-b-pow(d,0.5))/(2*a); 
    x2=(-b+pow(d,0.5))/(2*a);
    cout<<"real and distinct"<<endl<<x1<<" "<<x2;
}
else if(d==0){
    x2=(-b)/(2*a);
    x1=(-b)/(2*a);
    cout<<"real and equal"<<endl<<x2;
}
else if(d<0){
    cout<<"imaginary";
}

return 0;

}

Hey Ruchir, for passing the test cases your output should exactly match the output format.
for eg.
Input:
1 -11 28
Output:
Real and Distinct
4 7

but your code’s output is
real and distinct
4 7

Also when the roots are equal you are supposed to print both the roots
for eg. if root is 4, your output should be
Real and Equal
4 4

and in case of imaginary roots output should be
Imaginary

1 Like

but my code passed 2 testcases

Hey Ruchir, try the suggested changes if still your code is not working, then please share your updated code.