/* Program to find the value of root1 and root2 for a quadratic equation*/ /* June 2, 1998 */ #include #include main () { /* declaration */ double a, b, c, disc, root1, root2; /* Enter values */ printf ("Enter value of a> "); scanf ("%lf", &a); printf ("Enter value of b> "); scanf ("%lf", &b); printf ("Enter value of c> "); scanf ("%lf", &c); /* Calculation */ disc = pow(b,2) - 4*a*c; root1=(-b + sqrt(disc)) / (2*a); root2=(-b - sqrt(disc)) / (2*a); /* Display values */ printf("Root 1 is %.2f \n", root1); printf("Root 2 is %.2f \n", root2); }