using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("请输入最大数n");
int n = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(sum(n));
}
private static int sum(int n)
{
int nsum;
if (n == 1)
nsum = 1;
else
nsum = n * n + sum(n - 1);
return
nsum;
}
}
}