判断闰年

    科技2025-10-02  13

    在这里插入代码片 ```//判断是否为闰年 import java.util.Scanner; public class Runnian{ public static void main (String[] args){ Scanner sc = new Scanner(System.in); int x; System.out.println("输入x "); x = sc.nextInt(); if(x % 4 == 0 && x % 100 != 0 || x % 400 == 0){ System.out.println ( x + "是闰年"); } else{ System.out.println ( x + "不是闰年"); } } }
    Processed: 0.009, SQL: 8