#include<stdio.h>
#include<math.h>
int main()
{
int a,b,c,x;
float root1,root2;
printf("enter the coefficient a,b,c:");
scanf("%d%d%d",&a,&b,&c);
x= b*b-4*a*c;
if(x>0)
{
root1=(-b+(x))/(2*a);
root2=(-b-(x))/(2*a);
printf("root1=%f and root2=%f",root1,root2);
}
else if(x==0)
{
root1=root2=-b/(2*a);
printf("root1=root2=%2f",root1);
}
else
{
printf("The roots are imaginary");
return 0;
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: