![]() ![]() ![]() Printf ("The roots are imaginary and unequal and the roots are %f %fi ", r1, r2) Printf ("The roots are real and unequal and the roots are %f %f ", r1, r2) Printf ("n The roots are real and equal and the roots are %f %f",r1,r2) Printf ("Enter the values of a, b and c n") This program can also be executed by using the switch statement. If the value of x is greater than 0 then the process associated with the else if condition is executed, otherwise the value associated with the else condition is executed. Now, if the value of x is 0 then the process associated with the if condition is executed. Is calculated by the statement sqrt (fabs(x)) where fabs means absolute value of float. The keyword sqrt() calculates the square root. The values a, b and c are entered by the user. Printf (“The roots are imaginary and unequal and the roots are %f %fi “, r1, r2) Printf (“The roots are real and unequal and the roots are %f %f “, r1, r2) Printf (“n The roots are real and equal and the roots are %f %f”,r1,r2) Printf (“Enter the values of a, b and c n”) A quadratic equation is an equation of the form ax 2 + bx + c = 0 where a, b and c are constants.Īnd the formula to calculate the roots of the quadratic equation is:Ĭ program to find the roots of a quadratic equation is shown below. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |