java编写润年我有一个题:“使
public class Test{
public static void main(String[] args) {
int pos = 1;
for(int i=2000; i<2100; i+=4){
if(i%100==0&&i%400!=0)
continue;
if(pos<10) {//the first to ninth in a line
pos++;
int(i+" ");
}
else {//the tenth in a line
int(i);
intln();
pos=1;
}
}
}
}。 全部
public class Test{
public static void main(String[] args) {
int pos = 1;
for(int i=2000; i<2100; i+=4){
if(i%100==0&&i%400!=0)
continue;
if(pos<10) {//the first to ninth in a line
pos++;
int(i+" ");
}
else {//the tenth in a line
int(i);
intln();
pos=1;
}
}
}
}。
收起