1
Answer

Help on recursion

Daniel Lee

Daniel Lee

17y
2k
1

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)