#include <iostream> using namespace std; #include <cmath> int main() { float a, b, c; float delta; float x1, x2; float ture, imaginary; while (scanf("%f %f %f", &a, &b, &c) != EOF) { delta = b * b - 4 * a * c; ture = -b / (2 * a); imaginary = sqrt(delta) / 2 / a; if ( a == 0 ) { printf("Not quadratic equation\n"); } else { if (delta == 0) { if (a > 0) { x1 = x2 = ture + imaginary; printf("x1=x2=%.2f\n", x1); } else { x1 = x2 = ture - imaginary; printf("x1=x2=%.2f\n", x1); } } else if (delta > 0) { x1 = ture - imaginary; x2 = ture + imaginary; printf("x1=%.2f;x2=%.2f\n", x1, x2); } else { delta = -delta; imaginary = sqrt(delta) / 2 / a; printf("x1=%.2f-%.2fi;", ture, imaginary); printf("x2=%.2f+%.2fi\n", ture, imaginary); } } } return 0; }