TEST EXAMPLE:
b = 3
c = 19
constant = 4
Sum = 55
(3 + 7 + 11 + 15 + 19 = 55)
The logic is:Adding the numbers of an arithmetic line using recursive functioning
But my code outputs only the "return c" line
class Program
{
static int Line(int b, int c, int constant, int sum)
{
if (b > c) return c;
return (sum = sum + (Line(b+constant, c, constant, sum)));
}
static void Main(string[] args)
{
Console.WriteLine(Line(3,19,4,0));
Console.ReadKey();
}
}
sumparameter.