#include
#include
#include
main()
{
int a,b,c;
double d,e,x1,x2;
clrscr();
printf("Enter values of coefficients of quadratic equation ");
scanf("%d%d%d",&a,&b,&c);
d=b*b-4*a*c;
e(-b)/(float)(2*a);
if(d==0)
{
x1=-b/(float)(2*a);
printf("\nRoots are real and equal\n");
printf("\nroot 1 = root 2 = %f",x1);
}
else
{
if(d>0)
{
printf("\nRoots are real and different\n");
x1=e+ sqrt(d)/(float)(2*a);
x2=e- sqrt(d)/(float)(2*a);
printf("\nRoot 1 = %f",x1);
printf("\nroot 2 = %f",x2);
}
else
{
printf("\nRoots are immaginary\n");
d=d*(-1);
x1=sqrt(d)/(float)(2*a);
x2=sqrt(d)/(float)(2*a);
printf("\nRoot 1 = %f + %f i",e,x1);
printf("\nRoot 2 = %f - %f i",e,x2);
}
}
getch();
}
i dint get the 13th line....
ReplyDelete