In algebra quadratic equation refers to any equation that can be arranged in the form of `ax`

. The formula to solve the quadratic equation is as follows: ^{2}+bx+c=0

`-b+sqrt(b`

or ^{2}-4ac)/2a`-b-sqrt(b`

^{2}-4ac)/2a

You can also calculate the roots of a quadratic equation using c programming language. Below is the program to find roots of quadratic equation.

## Roots of a Quadratic Equation in C Programming

```
#include<stdio.h>
#include<math.h>
int main()
{
int a,b,c,d;
double root_1,root_2;
printf("\n\nEnter the Values of A, B, C, Where (a*X*X) + ( b*X ) + (c) = 0\n");
scanf("%d%d%d",&a,&b,&c);
d= (b*b)-(4*a*c);
if( d>=0 )
{
root_1=(-b+sqrt(d))/(2*a);
root_2=(-b-sqrt(d))/(2*a);
printf("First root = %.2lf\n", root_1);
printf("Second root = %.2lf\n", root_2);
}
else
{
printf("First Root = %.2lf + i%.2lf\n", -b/(double)(2*a), sqrt(-d)/(2*a));
printf("Second Root = %.2lf - i%.2lf\n", -b/(double)(2*a), sqrt(-d)/(2*a));
}
return 0;
}
```

```
Enter the Values of A, B, C, Where (a*X*X) + ( b*X ) + (c) = 0
1 -2 1
First root = 1.00
Second root = 1.00
```