#include #include int main() { float a, b, c, d; float root1, root2; int x; x = 1; while ( x== 1) { printf("Solving quadratic equation: ax^2+bx+c=0\na = "); scanf("%f" , &a); while (a == 0) { printf("a can't be equal to 0\na = "); scanf("%f", &a); } printf("b = "); scanf("%f", &b); printf("c = "); scanf("%f", &c); d = b * b - 4 * a * c; if ( d < 0 ) printf("No real root\n\n"); else if ( d == 0 ) { root1 = -b / (2 * a); printf("There is an equal root.\n"); printf("It is %1.0f.\n\n",root1); } else { root1 = (-b + sqrt(d)) / (2 * a); root2 = (-b - sqrt(d)) / (2 * a); printf("There are two real roots.\n"); printf("They are %1.0f",root1); printf(" and %1.0f.\n\n",root2); } printf("Continue(yes=1/no=0)?"); scanf("%i",&x); printf("\n"); } return 0; }