C#判断年份是否为闰年

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 闰年
{
    class Program
    {
        static void Main(string[] args)
        {
            int year;
            Console.WriteLine("请输入年份");
                year = Convert.ToInt32(Console.ReadLine());
            if((year%400==0)||(year%4==0&&year%100!=0))
                Console.WriteLine("It is leap year!");
            else
                Console.WriteLine("Tt is not a leap year!");
        }
    }
}

转载于:https://www.cnblogs.com/11forevercute/p/11025820.html

你可能感兴趣的:(C#判断年份是否为闰年)