Advertisement Remove all ads

Draw the Flowchart for Finding the Roots of Quadratic Equation. Write Program for Same. - Structured Programming Approach

Advertisement Remove all ads
Advertisement Remove all ads
Advertisement Remove all ads

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

Advertisement Remove all ads

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?
Advertisement Remove all ads
Share
Notifications

View all notifications


      Forgot password?
View in app×