Last active
July 7, 2022 21:08
-
-
Save AhmedTarekHasan/19092a6ca5ad50f06aa582dd59bb18fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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