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

  • 相关阅读:
    转:Gerrit 学习
    list, set操作
    Dice chrone execise
    【转】terminal 快捷键
    python package list
    爬虫2
    爬虫 1
    django跨表联查传输数据到前端
    vue实现鼠标移入移出事件
    pycharm意外关闭导致报错Unexpected content storage modification:
  • 原文地址:https://www.cnblogs.com/wjwz/p/14131861.html
Copyright © 2011-2022 走看看