麻烦看下代码是否正确?

来源:4-7 编程练习

cccxxxxx

2018-01-22 23:31:16

public class PracticeDemo {


public static void main(String[] args) {

int ge=0,shi=0,bai=2;

for(bai=2;bai<3;bai++) {

for(shi=0;shi<10;shi++) {

for(ge=0;ge<10;ge++) {

if((ge+shi+bai==12)&(ge*shi*bai==42)){

System.out.println(bai+""+shi+""+ge);

}

}

}

}


}


写回答

1回答

大佬金

2018-01-22

没有什么问题,就是最外层循环只运行一遍的话没有写的必要。

0
hccxxxxx
h 好的,谢谢
h018-01-23
共1条回复

0 学习 · 14452 问题

查看课程