Blog Archive

Sunday, August 29, 2010

Find the roots of the quadratic equation

/*
Find the roots of the quadratic equation
*/
#include<conio.h>
#include<stdio.h>
#include<math.h>
void main()
{
int a,b,c;
printf("Enter The Value Of a,b,c In A Quadratic Equation.");
scanf("%d%d%d",&a,&b,&c);
printf("%d %d %d",a,b,c);
if((b*b - 4*a*c) < 0)
{

printf("Roots Are Not Real.");
return;

}

printf("First Root Is %f, And Second Roor Is %f",(-(b) - sqrt(b*b - 4*a*c))/2*a, (-(b) + sqrt(b*b - 4*a*c))/2*a);

}

No comments:

Post a Comment