using System;
namespace 日期
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("请输入年");
int Y = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("请输入月");
int M = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("请输入日");
int D = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(Y + "年" + M + "月" + D + "日是今年的第" + Date(Y,M, D) + "天");
}
static int Date(int y, int m, int d)
{
//定义b装天数
int b = 0;
//数组装天数
int[] array = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
//除2月外还有11个月,所以i=1,i<12
for (int i = 1; i < m; i++)
{
//闰年
if (y % 4 == 0 && y % 100 != 0 || y % 400 == 0)
{
b = b + array[i];
}
//平年
else
{
array[1] = 28;
b = b + array[i];
}
}
d = d + b;
//返回天数
return d;
}
}
}