Need help using Recursive method to print increasing numbers 1 thru n
843789Feb 20 2010 — edited Feb 21 2010I know how to print out number decreasing using a Recursive method:
public static void CountDown2(int n)
{ if(n < 0) n = - n;
if(n > 0){
System.out.print(" " + n);
CountDown2(n - 1);}
}
So how can you print out the numbers with 1 through n? I guess the base case would be the original integer n, but I am still not sure how to do this. Thanks!