Hi, so for an assignment I have to print out all the odd numbers between an inputed number and 0, and then print out a count of how many numbers there are, using only a recursive method (named int odd (int n). I have the printing working, I just can't seem to get the count to work. What am I doing wrong?
public static int odds(int n) { if (n%2==0) { n=n-1; } if (n==1) { System.out.print(""); } else { System.out.print(n+" "); n=odds(n-2); count++; } return n; }