#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float a,b,c,x1,x2,d;
clrscr();
printf("enter the values of a,b,c");
scanf("%f%f%f",&a,&b,&c);
d=b*b-4*a*c;
if(d>0)
{
x1=(-b+sqrt(d))/2;
x2=(-b-sqrt(d))/2;
printf("roots are x1,x2 =%f,%f",x1,x2);
}
else if(d==0)
{
x1=x2=-b/(2*a);
printf("roots are x1,x2 =%f,%f",x1,x2);
}
else
{
printf("roots are imaginary");
}
getche();
}
#include<conio.h>
#include<math.h>
void main()
{
float a,b,c,x1,x2,d;
clrscr();
printf("enter the values of a,b,c");
scanf("%f%f%f",&a,&b,&c);
d=b*b-4*a*c;
if(d>0)
{
x1=(-b+sqrt(d))/2;
x2=(-b-sqrt(d))/2;
printf("roots are x1,x2 =%f,%f",x1,x2);
}
else if(d==0)
{
x1=x2=-b/(2*a);
printf("roots are x1,x2 =%f,%f",x1,x2);
}
else
{
printf("roots are imaginary");
}
getche();
}