ok my program is supposted to return the greatest common divisor of two inputted numbers (i and j), the numbers are already assigned to l(largest) and s (smallest), i need to make a class, so so far i have (for the class) (r = remainder) wehn the remainder is 0, then the smallest should be returned:
public int gcd(int l, int s, int i, int j)
{
int r = l % s;
if (r == 0)
return s;
else
gcd(s,r,i,j);
}
how can you do this without having the error of no return statement ( if the 'if' is not ran) thanks
2006-10-22
11:07:58
·
1 answers
·
asked by
YahooAnswers
2
in
Computers & Internet
➔ Programming & Design
Thanks so much anal pogrammer
ur the best answer
2006-10-22
11:19:09 ·
update #1