请阅读下面的程序public class Test { public static void main(String[] args) { int temp = 0; for (int i = 1; i < 5; i++) { for (int j = 0; j < i; j++) { temp++; } } System.out.println(temp); }}下列选项中,哪个是程序的运行结果()
A: 5
B: 9
C: 10
D: 15
A: 5
B: 9
C: 10
D: 15
举一反三
- 下面程序的运行结果是 public class Test { public static void main(String[] args) { int temp = 0; for (int i = 1; i < 5; i++) { for (int j = 0; j < i; j++) { temp++; } } System.out.println(temp); } }
- 请阅读下面的程序 public class Test { public static void main(String[] args) { int a = { 2, 0, 4, 1, 8, 3, 5 }; int temp; for (int i = 0; i < a.length - 1; i++) { for (int j = a.length - 1; j > i; j--) { if (aj < aj - 1) { temp = aj; aj = aj - 1; aj - 1 = temp; } } } for (Integer i : a) { System.out.print(i); } }} 下列选项中,哪个是程序的运行结果() A: 8543210 B: 0123458 C: 2041835 D: 以上答案都不对
- 下列程序的运行结果是()。 public class Test public static void main ( String [ ] args ) int count = 0 for( int i = 1 i < 5 i = 2) for( int j = 1 j< = 10 j = 3) count System .out .print (count ) _
- 请阅读下面的程序 Public class Test { public static void main(String[] args) { int a = 0; int b = 0; for (int i = 1; i <= 5; i++) {
- 以下程序的运行结果为( ) public class Ex6 { public static void main(String[] args) { int i,j,k; for(i=0;i<3;i++){ for(j=1;j<4;j++){ for(k=2;k<5;k++){ if((i==j)&&(j==k)) System.out.println(i); } } } } }