Quadratic Equations Root Code

During compilation, the code gives correct results but while submission,it shows all test cases failed.
My code:
#include
#include
using namespace std;

int main() {

float a, b, c, x1, x2, discriminant, realPart, imaginaryPart;
cin >> a >> b >> c;
discriminant = b*b - 4*a*c;

if (discriminant > 0) {
    x1 = (-b + sqrt(discriminant)) / (2*a);
    x2 = (-b - sqrt(discriminant)) / (2*a);
    cout << "Real and distinct" << endl;
    cout << x1 <<" "<< x2 << endl;
    
}

else if (discriminant == 0) {
    cout << "Real and equal" << endl;
    x1 = -b/(2*a);
    cout << x1 << " "<< x1 << endl;
}

else {
    realPart = -b/(2*a);
    imaginaryPart =sqrt(-discriminant)/(2*a);
    cout << "Imaginary"  << endl;
    cout << realPart << "+" << imaginaryPart << "i" << " "<<realPart << "-" << imaginaryPart << "i" << endl;
}

return 0;

}

you need to print the output as given in the question:
as :
line 1: Nature of Roots as: “Real and Distinct” or “Real and Equal” or “Imaginary”
line 2: contain the roots separated by a space…

No need to print other than these two lines…

Your Modified Code is:

I hope this helps