• 判断一年是否为闰年


            static void Main(string[] args)
            {
                while (true)
                { 
                    Console.WriteLine("请输入您的年份");
                    int x = Convert.ToInt32(Console.ReadLine());
                    try
                    {
                      DateTime y = Convert.ToDateTime(x+"-2-29");   //只要年份有2月29就是闰年
                      Console.WriteLine("是闰年");

                    }
                    catch (Exception)
                    {
                        Console.WriteLine("不是闰年");
                      
                    }
                    Console.ReadLine();

  • 相关阅读:
    poj 3071 Football (概率dp)
    CF1408G Clusterization Counting
    2-sat
    线段树优化建图
    SP5971 LCMSUM
    [NOI2020]命运
    SP19149 INS14H
    Atcoder ARC-068
    CF908G New Year and Original Order
    (四)、Fiddler打断点
  • 原文地址:https://www.cnblogs.com/lk-kk/p/4388119.html
Copyright © 2020-2023  润新知