Bootstrap

第6周作业1-闰年之循环判断

public class LeapYearFor {  
    public static void main(String[] args) {  
        int i,j=0;  
        // int year=0;  
         for(i=1800;i<=2006;i++){  
        // if((year%4==0&&year%100!=0)||(year%400==0)) {  
         if((i%4==0&&i%100!=0)||(i%400==0)) {  
         j++;  
        // System.out.print(j+"\t");  
         System.out.print(i+"\t");  
         if(j%5==0) {System.out.println();}  
         }  
         }  
        // if(year%5==0) System.out.println();  
  
    }  
  
}  


;