定义一个变量能不能被二整除如果能就输出这个数不能就输出不能被二整除且这个数>=10在100以内用if语句
int s=13;
if(s>=10||s<100){
if(s%2==0){
System.out.println("整除");
}else{//不能被整除
System.out.println("不能被整除");
}
System.out.println(s%2);
}
public class test {
public static void main(String[] args) throws NoSuchFieldException, IllegalAccessException {
test(15);
}
public static void test(int a){
if(a<10 || a>100){
System.out.println("参数非法");
return;
}
if(a % 2 == 0){
System.out.println(a);
}else{
System.out.println(a+"不能被2整除");
}
}
}