Thread: JAVA if problem
View Single Post
  #1 (permalink)  
Old 07-24-2007, 06:39 AM
toby toby is offline
Member
 
Join Date: Jul 2007
Posts: 40
toby is on a distinguished road
JAVA if problem
Hi, I am working on a JAVA if problem. Basically it checks if the number inputted is larger than 0. If it is, it does another IF statement which checks if the number is even or odd and returning 0 or 1 respectively. Either one should then return to the original IF problem but with half the n value. Here is what i done but it does not seem to work and returns errors:

Code:
static String test(int n) { if (n >0) { if (n%2 == 0) return 1; n+test(n%2); else return 0; n+test(n%2); } else return; }
Thanks.
Reply With Quote
Sponsored Links