1.package finish;
import java.util.*;
public class csy {
public static void main(String[] args) {
System.out.println("请输入一个年份:");
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
if(a%4==0 && a%100 !=0 ||a%400==0){
System.out.println("是闰年");
}else{
System.out.println("不是闰年");
}
}
}
![](https://img2020.cnblogs.com/blog/1967842/202003/1967842-20200324212334089-1096179346.png)
2.package finish;
import java.util.*;
public class csy {
public static void main(String[] args) {
System.out.println("请输入一个会员卡号:");
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
if((a /100%10) %3 ==0){
System.out.println("是幸运会员");
}else{
System.out.println("不是幸运会员");
}
}
}
![](https://img2020.cnblogs.com/blog/1967842/202003/1967842-20200324212411489-780997149.png)
3.package finish;
import java.util.*;
public class csy {
public static void main(String[] args) {
Scanner SC=new Scanner(System.in);
System.out.println("请输入x");
double x=SC.nextDouble();
double y;
if(x > 0){
y = (x + 3);
}else if(x == 0){
y = 0;
}else{
y = x*2-1;
}
System.out.println("输出y的值" +y);
}
}
![](https://img2020.cnblogs.com/blog/1967842/202003/1967842-20200324212437342-1879254748.png)
4.package finish;
import java.util.*;
public class csy {
public static void main(String[] args) {
Scanner SC=new Scanner(System.in);
System.out.println("请输入三个数");
double x=SC.nextDouble();
double y=SC.nextDouble();
double z=SC.nextDouble();
if((x+y)>z && (x+z)>y && (y+z)>x){
System.out.println("可以构成三角形");
}else{
System.out.println("不能构成三角形");
}
}
}
![](https://img2020.cnblogs.com/blog/1967842/202003/1967842-20200324212501366-554011360.png)