1.
package hh;
import java.util.Scanner;
public class KK {
public static void main(String[] args) {
System.out.println("请输入年份:");
Scanner input=new Scanner(System.in);
int a=input.nextInt();
if(a%4==0||a%100!=0&&a%400==0){
System.out.println("闰年");
}
else{
System.out.println("不是闰年");
}
}
}
2.
package hh;
import java.util.Scanner;
public class KK {
public static void main(String[] args) {
int b;
System.out.println("请输入会员卡号:");
Scanner input=new Scanner(System.in);
int a=input.nextInt();
b=a/100%10;
if(b%3==0){
System.out.println("是幸运会员");
}
else{
System.out.println("不是幸运会员");
}
}
3.
package hh;
import java.util.Scanner;
public class KK {
public static void main(String[] args) {
System.out.println("请输入x的值:");
Scanner input=new Scanner(System.in);
int x=input.nextInt();
if(x>0){
System.out.println(x+3);
}
else if(x==0){
System.out.println(0);
}
else{
System.out.println(x*2-1);
}
}
}
4.
package hh;
import java.util.Scanner;
public class KK {
public static void main(String[] args) {
System.out.println("请输入三角形的三条边:");
Scanner input=new Scanner(System.in);
int x=input.nextInt();
int y=input.nextInt();
int z=input.nextInt();
if(x+y>z&&x+z>y&&y+z>x){
System.out.println("可以构成三角形");
}
else{
System.out.println("不能构成三角形");
}
}
}