判断是否是闰年的函数

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            bool a = IsRun(2000);
            Console.WriteLine("the year is {0} leap year ", a);
            Console.ReadKey();
        }
        public static bool IsRun(int year)
        {
            bool b = (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0);
            return b;
        }
    }
}

猜你喜欢

转载自www.cnblogs.com/yuanshou/p/10263521.html