立即注册 登录
气象家园 返回首页

15195775117的个人空间 http://bbs.06climate.com/?43007 [收藏] [复制] [分享] [RSS]

日志

Java之判断闰年

已有 85 次阅读2018-5-4 09:51 |个人分类:Java

  Scanner input=new Scanner(System.in);
  int year=input.nextInt();
  if(year % 100 ==0) {
   System.out.println("是整百年");
   if(year % 400 ==0) {
    System.out.println("闰年");
   }else {
    System.out.println("不是闰年");
   }
  }else {
   System.out.println("非整百年");
   if(year % 4 ==0) {
    System.out.println("闰年");
   }else {
    System.out.println("不是闰年");
   }
  }

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 立即注册

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

返回顶部