using System; namespace Example64 { /// /// Summary description for Class1. /// class Class1 { /// /// The main entry point for the application. /// [STAThread] static void Main(string[] args) { Console.Write("Input n: "); int n = int.Parse(Console.ReadLine()); Console.WriteLine("The sum of the first {0} integers is: {1} = {2}", n, sum(n), n * (n +1) / 2); } static int sum(int n) { if (n == 1) return 1; else return n + sum(n - 1); } } }