English

Draw the Flowchart for Finding the Roots of Quadratic Equation. Write Program for Same.

Advertisements
Advertisements

Question

Draw the flowchart for finding the roots of quadratic equation. Write program for same. 

Advertisements

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
shaalaa.com
Three Construct of Algorithm and Flowchart
  Is there an error in this question or solution?
2018-2019 (December) CBCGS
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×