创建一个方法来判断是否为闰年。。

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

namespace 建一个判断是否为闰年的方法_函数_
{
    class Program
    {    
        /// <summary>
        /// 判断一个年份是否为闰年
        /// </summary>
        /// <param name="year">要判断的年份</param>
        /// <returns>返回是否为闰年</returns>
        public static bool IsRun(int year)
        {
            bool b = (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0);
            return b;
        }
        static void Main(string[] args)
        {
            bool b = IsRun(int.Parse(Console.ReadLine()));
            Console.WriteLine(b);
            Console.ReadLine();
            
        }
    }
}

 

posted @ 2015-06-15 23:51  骏码信息  阅读(203)  评论(0编辑  收藏  举报