标签:logs height import java基础 str ring todo idt generated
润年案例
package test;
import java.util.Scanner;
public class runnian {=
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.print("请输入年份:");
Scanner s = new Scanner(System.in);
int n = s.nextInt();
//润年判断:能被4整除但不能被100整除的年份,或者能被400整除的年份1900
if(((n%4==0)&&(n%100!=0))||(n%400==0)){
System.out.println(n+"是润年");
}
else{
System.out.println(n+"不是润年");
}
}
}
运行结果:
请输入年份:1900
1900不是润年
标签:logs height import java基础 str ring todo idt generated
原文地址:http://www.cnblogs.com/lilijun/p/7277783.html