PROGRAM TO FIND ROOTS OF QUADRATIC EQUATION IN C
In this example, you will learn a program to find the roots of quadratic equations.
The standard form of Quadratic equation is:
ax²+bx+c = 0,
and a,b,c are the real numbers
such that a !=0
b²-4ac is known as the discriminant of the quadratic equation and it tells about the nature of roots of quadratic equation.
1. If discriminant is >0, then roots are real and different.
2. If discriminant is =0, then roots are real and equal.
3.If discriminant is <0, then roots are not real(i.e. complex) and different.
Program:
//Program to find roots of quadratic equation
#include<math.h>
}
#include<math.h>
}
Output:
Enter coefficients a, b and c: 2 12 3
r1= -0.26 and r2= -5.74
r1= -0.26 and r2= -5.74
So that's it ! Just try this code by your own. If you have any doubts then feel free to drop a comment . I'll be happy to answer your questions .
Keep coding....
Comments
Post a Comment