请JAVA高手解决!!!!!!!!!!!!!!!!!!!!

2024-12-26 04:12:13
推荐回答(5个)
回答1:

public class Test {

public static void main(String[] args) {
for(int i = 100;i<=200;i++){
boolean bool = true;
if(i%4!=2)
bool= false;
if(i%7!=3)
bool= false;
if(i%9!=5)
bool= false;
if(bool)
System.out.println("总数为:"+i);

}
}

}

回答2:

public class test {

public static void main(String args[]){
for(int i=100;i<=200;i++){
if(i%4==2&&i%7==3&&i%9==5){
System.out.println(i);
}
}
}
}

输出:122

回答3:

public class ToolsTest {
public static void main(String args[]){
int i=14;
while(true){
if(i%4==2 && i%7==3 && i%9==5){
System.out.println("这堆零件为"+i+"个");
break;
}
i++;
}
}
}

回答4:

public class Test {
public static void main(String[] args) {
int min = 100;
int max = 200;
for(int i = min; i <= max; i++)
if(i % 4 == 2 && i % 7 == 3 && i % 9 == 5)
System.out.println("num = " + i);
}
}

回答5:

楼上都是正解