I have a question in recursion in C#.
My task is to print this:
1 2 3 4 5 @ 10 8 6 4 2 1
I have successfully printed this:
1 2 3 4 5 @ 10 8 6 4 2 0
However, I need to turn the 0 into 1.
This is my code:
public static void Recursive(int a, int b)
{
if (a > b)
{
Console.WriteLine("@");
Console.WriteLine(a * 2 - 2);
}
else
{
Console.WriteLine(a);
Recursive(a + 1, b);
Console.WriteLine(a*2-2);
}
}