WA:您共輸出 1 行 我不知道系統的意思 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.in); //System.out.print("enter"); while (true) { int cout = cin.nextInt(); if (cout % 4 == 0 &&cout%100!=0 ||cout%400==0) { System.out.println("閏年"); break; } else { System.out.println("平年"); } } } }
1. break拿掉
2. while裡面的true改成 cin.hasNextInt()