zoukankan      html  css  js  c++  java
  • 判断输入的年份是闰年还是平年!!!

    package com.hp.cn1;

    import java.util.Scanner;

    //年份能被4整除闰年
    //年份能被100整除不是闰年
    //年份能被400整除闰年
    public class Task2 {
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            System.out.println("---->请输入年份");
            int year  = sc.nextInt();
            System.out.println("你输入的年份是"+year);
            
            if(year % 100 == 0) {
                if(year % 400 == 0) {
                    System.out.println(year + "是闰年");
                }else {
                    System.out.println(year + "不是闰年");
                }
            }else {
                if(year % 4 == 0) {
                    System.out.println(year + "是闰年");
                }else {
                    System.out.println(year + "不是闰年");
                }
            }
        }
    }

  • 相关阅读:
    PS的使用[未完待续]
    Navicat破解方法【很靠谱】
    some blogs
    Linux curl命令详解
    api_automation_mysql
    linux 笔记
    pytest 笔记
    sel+python 基础
    postman 断言
    homebrew note
  • 原文地址:https://www.cnblogs.com/wjwz/p/14131861.html
Copyright © 2011-2022 走看看