static void Main(string[] args) { int result = GetResult(500); Console.WriteLine(result); Console.ReadLine(); } public static int GetResult(int number) { if (number == 1) return 1; return number + GetResult(number - 1); }