zoukankan      html  css  js  c++  java
  • 问题 B: 判断闰年

    题目描述

    使用C#编写一个控制台应用。输入-一个年份,判断是否润年(被4整除,且不被100整除,或者被400整除)。
    是闰年输出yes,不是输出no

    输入

    一个年份

    输出

    yes或者no

    样例输入

    1996

    样例输出

    yes

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace Helloworld
    {
        class Program
        {
            static void Main(string[] args)
            {
                int year = Convert.ToInt32(Console.ReadLine());
                if ((year % 4 == 0) && (year % 100 != 0) || year % 400 == 0)
                {
                    Console.WriteLine("yes");
                }
                else
                {
                    Console.WriteLine("no");
                }
                Console.ReadKey();
            }
        }
    }
    

      

  • 相关阅读:
    月食照片
    宾得镜头大全与发展史
    月食照片
    关于镜头系数的疑问
    经验和教训
    常用正则表达式
    12月19日
    部長面談
    周六
    异度空间
  • 原文地址:https://www.cnblogs.com/mjn1/p/12402651.html
Copyright © 2011-2022 走看看