在Java中,如下代码段的输出结果为( )。
public static void main(String []args) {
int num=1;
while(num<6){
System.out.print(num);
if(num/2==0)
continue;
else
num++;
}
}
public static void main(String []args) {
int num=1;
while(num<6){
System.out.print(num);
if(num/2==0)
continue;
else
num++;
}
}
举一反三
- 编译运行如下Java代码,输出结果是。 public class Test{ public static void main(String[] args){ int num=5; if(num<=5){ num+=2; System.out.println(num); } System.out.println(num+5); } }
- 以下程序段的输出结果是 。 int main(void) { int num = 0,s = 0; while(num <= 2){ num++; s += num; } printf("%d\n",s); return 0; }
- main(){int num=0;while(num<;=2){num++;printf("%d\n",num);}}
- public static void main(String[] args) {int num=0;for (int i = 0; i <; 5; i++) {for (int j = 0; j <;=5; j++) {num++;}}System.out.println(num); }程序执行完毕以后num的值为_____________.
- 下列程序的输出结果是() num = 27 count = 0 while num > 0: if num % 2 == 0: num /=2 elif num % 3 ==0: num /= 3 else: num -=1 count += 1 print (count)