Quadratic equations please tell error

#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;
   if(x1<x2)
   {
   		 cout  << x1 ;
   		 cout << x2 << endl;
   }
   else
   {
   		 cout  << x2 ;
   		 cout << x1 << endl;
   }
}

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

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

return 0;

}

hello @ahujaxrhythm

in output add spaces between the roots

#include #include using namespace std; int main() { float a, b, c, x1, x2, discriminant, realPart, imaginaryPart; cin >> a >> b >> c; discriminant = bb - 4ac; if (discriminant > 0) { x1 = (-b + sqrt(discriminant)) / (2a); x2 = (-b - sqrt(discriminant)) / (2a); cout << “Real and Distinct” << endl; if(x1<x2) { cout << x1 ; cout << x2 << endl; } else { cout << x2 ; cout << x1 << endl; } } else if (discriminant == 0) { cout << “Real and Equal” << endl; x1 = -b/(2a); cout << x1 << endl; } else { realPart = -b/(2a); imaginaryPart =sqrt(-discriminant)/(2a); cout << “imaginary” << endl; } return 0; } what should i type in imaginary part

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.