Daniel Lee

Daniel Lee

  • NA
  • 2
  • 0

Help on recursion

Oct 26 2007 10:38 PM

Hi a newbie to programming/C# here. Just a question on recursion I encountered. Using recursion, I need to print this series of numbers :

12344321

I know how to do the first portion.

[code]

public static void PrintNumber(int n)

{

if  (n==1)

Console.Write(n);

else

{

PrintNumber(n-1);

Console.Write(n);

}

}

[/code]

This will print out 1234, but how do I print the trailing 4321 in the same method using recursion?


Answers (1)