Skip to content

Instantly share code, notes, and snippets.

@AhmedTarekHasan
Last active July 7, 2022 21:08
Show Gist options
  • Save AhmedTarekHasan/19092a6ca5ad50f06aa582dd59bb18fa to your computer and use it in GitHub Desktop.
Save AhmedTarekHasan/19092a6ca5ad50f06aa582dd59bb18fa to your computer and use it in GitHub Desktop.
using System;
namespace SmallMethods
{
public class Program
{
static void Main(string[] args)
{
Console.WriteLine("Started");
var result1 = GetResultRecursively(50_000, 40_000);
var result2 = GetResultRecursively(40_000, 30_000);
var result3 = GetResultRecursively(30_000, 20_000);
var result4 = GetResultRecursively(20_000, 10_000);
var result5 = GetResultRecursively(10_000, 0);
Console.WriteLine("Ended");
Console.ReadLine();
}
private static int GetResultRecursively(int start, int end)
{
start--;
if (start == end)
{
return 0;
}
return GetResultRecursively(start, end);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment