1. 程式人生 > >判斷是否是閏年的函式

判斷是否是閏年的函式

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; } } }