下列表达式可以作为判断一个整数number为奇数的是()
A: number // 2 == 1
B: number // 2 == 0
C: number % 2 == 1
D: number / 2 == 1
A: number // 2 == 1
B: number // 2 == 0
C: number % 2 == 1
D: number / 2 == 1
举一反三
- Analyze the following code: Code 1: int number = 45; bool even; if (number % 2 == 0) even = true; else even = false; Code 2: int number = 45; bool even = (number % 2 == 0); A: Code 1 has compile errors. B: Code 2 has compile errors. C: Both Code 1 and Code 2 have compile errors. D: Both Code 1 and Code 2 are correct, but Code 2 is better.
- 以下程序的输出结果是___________。 number = 10 if number % 2 == 0: print(number, 'is even') elif number % 5 == 0: print(number, 'is multiple of 2')
- int number_range=20;int number=2;boolean isprime=true;while(number<;number_range){isprime=true;for(int divlsor=2;divlsor<;=number/2;divlsor++){if(______){isprime=false;break;}}if(isprime){out.println(number+"<;br>;");}number++;}%>; A: divlsor%number==0 B: number%divlsor==0 C: divlsor/number==0 D: number/divlsor==0
- Your______,Please.(请______您的号牌。)(1)number……亮出(2)number……举高(3)anumber……出示 A: (1) B: (2) C: (3)
- Your______,Please.(请______您的号牌。)(1)anumber……出示(2)number……亮出(3)number……举高 A: (1) B: (2) C: (3)