/* * Program to find real roots (if any) of quadratic equation. * As developed in class, so may not be 100% correct! */ #include #include int main(void) { float a, b, c; printf("enter three coefficients\n"); if (scanf("%f %f %f", &a, &b, &c) == 3) { if (a == 0) printf("special case\n"); else if ((b*b - 4*a*c) >= 0) { printf("%f\n", (-b + sqrt(b*b - 4*a*c))/(2*a)); printf("%f\n", (-b - sqrt(b*b - 4*a*c))/(2*a)); } else { printf("no real roots\n"); } } else { printf("error\n"); } return 0; }