lk-kk

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("该年不是闰年");
                }
              
            }
        }
    }
}

分类:

技术点:

相关文章:

  • 2021-11-28
  • 2021-11-28
  • 2021-11-28
  • 2021-11-28
  • 2021-11-28
  • 2021-03-30
  • 2022-12-23
  • 2021-11-28
猜你喜欢
  • 2021-11-28
  • 2021-11-28
  • 2021-11-28
  • 2021-11-28
相关资源
相似解决方案