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!");
        }
    }
}

猜你喜欢

转载自www.cnblogs.com/11forevercute/p/11025820.html