main()
{
float a,b,c,d;
double i1,i2;
printf("Enter the values of a,b,c : ");
scanf("%f %f %f",&a,&b,&c);
d=pow(b,2)-4.0*a*c;
if (d>=0)
{
i1=(-b+sqrt(d))/(2*a);
i2=(-b-sqrt(d))/(2*a);
if (d==0)
printf("\nThe roots are real and equal.");
else
printf("\nThe roots are real and unequal\n");
printf("\nThe roots of the quadratic equation are %lf and %lf\n",i1,i2);
}
else
printf("\nThe roots are imaginary!");
}
No comments:
Post a Comment