for (int i = 0; i < 20; i++) { int first = i+1; for (int j = 0; j < 20 ; j=j+1+i%2) { int second = j+1; //如果同时为偶数,则跳出本次循环 System.out.println("首当其冲:"+first +"退而求次:"+ second +",结果等于"+ String.format("%.3f", first / new Double(second))); } }
pushback
2020-07-20 16:57:04 +08:00
// scope 1~20 int[] moArr = {19, 2, 3, 5, 6, 8, 15, 20, 1}; int[] deArr = {6, 7, 3, 2, 12, 18, 11, 19, 9}; for (int i = 0; i < moArr.length; i++) { int mo = moArr[i]; for (int j = 0; j < deArr.length; j++) { int de = deArr[j]; {continue;} } } for 第二段是 end 条件,你要在里面进行 continue,有点骚