Find out the quardratic equation


Write a program for the following equation ax2+bx+c
Program:
#include<stdio.h>
#include<math.h>
main(){
float a,b,c,x1,x2,d;

printf("A=? , B=? , C=? ");
scanf("%f %f %f", &a, &b, &c);

d=b*b-4*a*c;

if(d>0)
{
x1=(-b+sqrt(d))/2*a;
x2=(-b-sqrt(d))/2*a;
}

else if(d==0)
{
x1=-b/2*a;
x2=-b/2*a;
}

else
printf("Negative number so program not possible calculation.");

if(d>=0)
printf("X1=%f, \n X2=%f", x1, x2);
}
 

Loading
Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Flying Twitter Bird Widget By ICT Sparkle