package kljjjjj; public class kljjjjj { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("输入年份"); int year=2020; if ( ( 2020 % 4==0 && 2020 % 100!=0)||(2020%400!=0)) { System.out.println("闰年"); } else { System.out.println("不是闰年"); } }
package kljjjjjj; import java.util.*; public class kljjjjjj { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input=new Scanner(System.in); int x=input.nextInt(); int y; if(x>0) y=x+3; else if(x < 0) y=0; System.out.println("y"); }
package kljjjjjjj; import java.util.Scanner; public class kljjjjjjj { public static void main(String[] args) { Scanner AA = new Scanner(System.in); System.out.println("输入三个正整数"); int a = AA.nextInt(); int b = AA.nextInt(); int c = AA.nextInt(); if (a<=0||b<=0||c<=0){ System.out.println("输入错误,请重新输入"); }else if ((a+b)>c&&(a+c)>b&&(b+c)>a){ System.out.println("能构成三角形"); }else System.out.println("不能构成三角形"); } }
//2.输入一个4位会员卡号,如果百位数字是3的倍数,就输出是幸运会员,否则就输出不是. @SuppressWarnings("resource") Scanner sc=new Scanner(System.in); int a=sc.nextInt(); int b=a%1000/100; if(a>999||a<10000) {//判断输入是否正确 if(b%3==0) { System.out.println("恭喜您为我们的幸运会员"); }else{ System.out.println("很抱歉您不是我们的幸运会员"); } }else { System.out.println("输入错误请重新输入"); }