[单选题]

有以下程序 public class Sun { public static void main(string args[ ]) { int a, b; for(a=1, b=1; a<=100; a++) { if(b>=10) break; if (b%3==1) { b+=3; continue; } } System.out.println(A) ; } } 执行后的输出结果是( )。

A.101

B.6

C.5

D.4

参考答案与解析:

相关试题

有以下程序public class Sun{public static void

[单选题]有以下程序 public class Sun { public static void main(string args[ ]) { int a, b; for(a=1, b=1; a<=100; a++) { if(b>=10} break; if (b%3 1) { b+=3; continue; } } System.cut.println(A) ; } } 执行后的输出结果是( )。A.101B.6C.5D.4

  • 查看答案
  • 有如下程序public class Sun{public static void

    [单选题]有如下程序 public class Sun { public static void main(String args[ ]) { int x=1,a=0,b=0; switch(x) { case 0:b++; case 1:a++; case 2: a++; b++; } System.out.println("a="+a+","+"b="+B) } }该程序的输出结果是( )。A.a=2,b=1B.a=1,b=1C.a=1,b=0D.a=0,b=0

  • 查看答案
  • 有如下程序: public class Sun{public static vo

    [单选题]有如下程序: public class Sun { public static void main(String args[ ]) { int s=0; int i=1; while (i<=100) { s=s+i; } System.out.println(s); } } 运行后的结果是( )。A.5050B.5051C.死循环,直到溢出D.无穷大的数

  • 查看答案
  • 有如下程序public class Sun{ public static voi

    [单选题]有如下程序 public class Sun { public static void main(String args[ ]) { int a=2,b=1,c=2; if(a<B) if(b<0) if(c<0) c=0; else C++; System.out.println(C) ; } } 上述程序的运行结果是( )。A.0B.1C.2D.3

  • 查看答案
  • 有如下程序:public class Sun{public static voi

    [单选题]有如下程序: public class Sun { public static void main(String args[ ]) { int s=0; int i=1; while(i<=100) { s=s+i; } System.out.println(s); } } 运行后的结果是( )。A.5050B.5051C.死循环,直到溢出D.无穷大的数

  • 查看答案
  • 设有如下程序:public class Sun{public static vo

    [单选题]设有如下程序: public class Sun { public static void main(String args[ ]) { int x,y; x=4; y=0; if(Math.pow(x,2)==16) y=x; if(Math.pow(x,2)<15) y=1/x; if(Math.pow(x,2)>15) y=(int)Math.pow(x,2)+1; System.out.println(y); } } 程序的运行结果是( )。A.4B.17C.18D.0.25

  • 查看答案
  • 设有如下程序:public class Sun{public static vo

    [单选题]设有如下程序: public class Sun { public static void main(String args[ ]) { int x,y; x=(int)Math.sqrt(2)/2+(int)Math.random()*2/2; y=(int)Math.sqrt(3)/3+(int)Math.random()*3/3; if (x>y) System.out.println("x>y"); else if (x==y) System.out.println("x=y")

  • 查看答案
  • 设有如下程序:public class Sun{public static vo

    [单选题]设有如下程序: public class Sun { public static void main (String args[ ]) { int x,y; x= (int) Math.sqrt (2) /2+ (int) Math.random ()*2/2; y= (int) Math.sqrt (3) /3+ (int) Math.random ()*3/3; if (x>y) System.out.println ("x>y"); else if (x==y) System.out.

  • 查看答案
  • 阅读下面的程序段:public class Sun{public static

    [单选题]阅读下面的程序段: public class Sun { public static void main(String args[ ]) { int a=0 for(int i=1;i<=3;i++) { for(int j=1;j<-i;j++) { for(int k=j;k<=3;k++) { a=a+1; } } } System.out.println(A) 我; }}执行上面的3重循环后,a的值为( )。A.3B.9C.14D.21

  • 查看答案
  • 设有如下程序:public class Sun{public static vo

    [单选题]设有如下程序: public class Sun { public static void main(String args[ ]) { int x, y; x-4; y=0; if(Math.pow(x,2)==16) y=x; if(Math.pow(x,2)<15) y=1/x; if(Math.pow(x,2)>15) y=(int)Math.pow(x,2)+1; System.out.println(y); } } 程序的运行结果是( )。A.4B.17C.18D.0.25

  • 查看答案
  • 有以下程序public class Sun{public static void