#include<stdio.h>//header file
#include<conio.h>//header file
#include<math.h>//header files
void main() //starting of the main() function
{
int a,c,m,b;
float x1,x2;
clrscr();
printf("program that calculates roots of a given equation");
printf("\n\n\n\t\t------------INPUT-------------");
printf("\n\nenter the values a,b and c for the quadratic equation");//taking input from the user
scanf("%d%d%d",&a,&b,&c);
m=pow(b,2)-4*a*c;
if(m>=0)
{
x1=(-b+(sqrt(pow(b,2)-4*a*c)));
x2=(-b-(sqrt(pow(b,2)-4*a*c)));
x1=x1/(2*a);
x2=x2/(2*a);
}
else
{
printf("\n\n\n\t\t------------OUTPUT------------");
printf("\n\nimaginary roots are obtained");
getch();
exit(0);
}
printf("\n\n\n\t\t------------OUTPUT------------");
printf("\n\nthe roots of the equation are=%f %f",x1,x2);//printing output
getch();
}