zoukankan      html  css  js  c++  java
  • 判断一年是否为闰年

    namespace 输入一个年份是否为闰年
    {
        class Program
        {
            static void Main(string[] args)
            {
                while (true)
                {
                    Console.WriteLine("请输入年份:");
                    int a = Convert.ToInt32(Console.ReadLine());
                    if ((a % 4 == 0 && a % 100 != 0) || a % 400 == 0)  //能被4整除但不能被100整除 或者 被400整除
                    {
                        Console.WriteLine("该年是闰年");
                    }
                    else
                    {
                        Console.WriteLine("该年不是闰年");
                    }
                  
                }
            }
        }
    }

  • 相关阅读:
    oracle 的exists 的用法
    linux
    C++纯虚函数
    C++ 的虚析构函数
    C++ new
    C++点和箭头操作符用法区别
    static
    关于C的int
    互斥量mutex的简单使用
    nginx服务器屏蔽上游错误码
  • 原文地址:https://www.cnblogs.com/lk-kk/p/4439802.html
Copyright © 2011-2022 走看看