[Java] 闰年计算器 →→→→→进入此内容的聊天室

来自 , 2019-08-19, 写在 Java, 查看 104 次.
URL http://www.code666.cn/view/944bdd96
  1. import java.util.Scanner;
  2.  
  3.  
  4.  
  5. public class LeapYear {
  6.  
  7.  
  8.  
  9.         public static void main(String[] args) {
  10.  
  11.                 Scanner input = new Scanner(System.in);
  12.  
  13.                 System.out.print("请输入年份:");
  14.  
  15.                 int year = input.nextInt();
  16.  
  17.                 if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) {
  18.  
  19.                         System.err.println(year + "年是闰年");
  20.  
  21.                 } else {
  22.  
  23.                         System.out.println(year + "年不是闰年");
  24.  
  25.                 }
  26.  
  27.         }
  28.  
  29.  
  30.  
  31. }//源代码片段来自云代码http://yuncode.net
  32.                        

回复 "闰年计算器"

这儿你可以回复上面这条便签

captcha