请阅读下面的程序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 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
请阅读下面的程序public class Test {public static void main(String[] args) {int m = 37;int n = 13;while (m != n) {while (m > n) {m -= n;}while (m < n) {n -= m;}}System.out.println("m=" + m);}}下列选项中,哪一个是正确的运行结果:
A. m=37
B. m=13
C. m=1
D. m=2
请阅读下面的程序。public class Test {public static void main(String[] args) {int a = 0;int b = 0;for (int i = 1; i <= 5; i++) {a = i% 2;while (a-- >= 0) {b++;}}System.out.println("a=" + a + ",b=" + b);}}下列选项中,哪一个是正确的运行结果:
A. a=8,b=-2
B. a=-2,b=8
C. a=0,b=3
D. a=3,b=0
请阅读下面的程序public class Test {public static void main(String[] args) {int x;int y;for (x = 1, y = 1; x <= 100; x++) {if (y >= 20) {break;}if (y % 3 == 1) {y += 3;continue;}y -= 5;}System.out.println("x=" + x +",y=" + y);}}下列选项中,哪一个是程序的运行结果:
A. x=8,y=22
B. x=22,y=8
C. x=3,y=0
D. x=0,y=3