Advertisement
Advertisement
Draw the flowchart for finding the roots of quadratic equation. Write program for same.
Advertisement
Solution
}
else if (discriminant == 0)
{
r1 = r2 = -b/(2*a);
printf("r1 = r2 = %.2lf;", r1);
}
else
{
rp = -b/(2*a);
ip = sqrt(-discriminant)/(2*a);
printf("r1 = %.2lf+%.2lfi and r2 = %.2f-%.2fi", rp, ip, rp, ip);
}
return 0;
}
Output: Enter coefficients a, b and c: 2.3 4 5.6 Roots are: -0.87+1.30i and -0.87-1.30i |
Concept: Three Construct of Algorithm and Flowchart
Is there an error in this question or solution?