d070: 文文的求婚--續集 (0 尾版)
題目:http://zerojudge.tw/ShowProblem?problemid=d070
程式碼:
程式碼:
import java.util.Scanner;
public class d070 {
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  Scanner sc = new Scanner(System.in);
  while(sc.hasNext()){
   int y = sc.nextInt();//輸入年分
   if(y == 0){
    break;
   }
   if((y%4==0 && y%100!=0) || y%400==0){
    System.out.println("a leap year");
   }else{
    System.out.println("a normal year");
   }
  }
 }
}

留言
張貼留言