| Author |
equation problem
|
oghenekaro EFEKODO
Ranch Hand
Joined: Oct 10, 2005
Posts: 56
|
|
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
|
 |
Martin Simons
Ranch Hand
Joined: Mar 02, 2006
Posts: 196
|
|
What error message. Also you declare to return a double but actually return nothing. Was this your error message, maybe?
|
 |
Vladimir Nesov
Greenhorn
Joined: Jun 18, 2006
Posts: 20
|
|
|
Also note that 10/2*5 is 25, not 1. You wrote wrong in your formulae.
|
 |
 |
|
|
subject: equation problem
|
|
|