怎么给a设范围(999<=a>=100)
Scanner inout = new Scanner(System.in);
System.out.println("请输入");
int a = inout.nextInt();
int a1=a/1000;
int a2=a/100%10;
int a3=a/10%10;
int a4=a%10;
int A=a1+a2+a3+a4;
System.out.println("A="+A);
Scanner inout = new Scanner(System.in);
System.out.println("请输入");
int a = inout.nextInt();
int a1=a/1000;
int a2=a/100%10;
int a3=a/10%10;
int a4=a%10;
int A=a1+a2+a3+a4;
System.out.println("A="+A);
2019-11-05
举报