posted 17 years ago
pls,i tried writing a program for quadratic equation but failed.i did this
public double equation(double a,double b,double c){
double d=Math.pow(b,2)-4*a*c;
if(d>0){
double x1=(-b+Math.sqrt(d))/2*a;
double x2=(-b-Math.sqrt(d))/2*a;
}
return;
}
couldn't attempt d==0 and d<0.
it was giving an error message.so what do i do and do solve others.thanks