using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace text1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("请输入一个正整数:");
int n = Convert.ToInt16(Console.ReadLine());
int result = 0;
if(n%2==0)
{
for(int i=0;i<=n;)
{
result = result + i;
i = i + 2;
}
Console.WriteLine("数列和为:"+result+"\n"+"输入回车结束");
}
else if(n%2!=0)
{
for(int i = 1; i <= n;)
{
result = result + i;
i = i + 2;
}
Console.WriteLine("数列和为:" + result + "\n" + "输入回车结束");
}
}
}
}