#include #include #include int main(void) { int a,b,c,D,error; float f; do { printf("Input numbers a, b, c (ax^2+bx+c): "); scanf("%d %d %d", &a, &b, &c); if(error = (a==0 && b==0)) printf("error\n"); } while(error); if(a != 0 && b != 0) { D=b*b-4*a*c; f=-b/(2*a); if(D > 0) printf("%15s%f+%f\n%20s%f-%f","two real roots: ",f,sqrt(D),"",f,sqrt(D)); else if(D < 0) printf("%15s%f+i*%f\n%20s%f-i*%f","two complex roots: ",f,sqrt(-D),"",f,sqrt(-D)); else printf("%15s%f\n","multiple real roots",f); } else if(a==0 && b!= 0) printf("degenerate : %f\n",-c/b); getch(); return 0; }