对数值型变量V_NUM,进行四舍五入,保留小数点后两位,以下操作正确的是()
A: SUBSTR(V_NUM,1,2)
B: TRUNC(V_NUM,2)
C: TRUNC(V_NUM,-2)
D: ROUND(V_NUM,2)
E: ROUND(V_NUM,-2)
A: SUBSTR(V_NUM,1,2)
B: TRUNC(V_NUM,2)
C: TRUNC(V_NUM,-2)
D: ROUND(V_NUM,2)
E: ROUND(V_NUM,-2)
举一反三
- 以下对于二维数组初始化正确的是( )。 A: int[3][] num = {{1,2}, {2}, {3,4,5}}; B: int[3][3] num = {{1,2}, {2}, {3,4,5}}; C: int[][3] num = {{1,2}, {2}, {3,4,5}}; D: int[][] num = {{1,2}, {2}, {3,4,5}};
- 编写一个函数判断客户输入一个数字为1位、2位还是更多为,代码如下:请补全空下的代码num=int(input("输入一位或两位的数字:"))n='0'(1)n='1'(2)n='2'(3)d='>;2'print(n+"位数。”) A: 1: if num>;-10 and num<;10:2: eilf num >;-100 and num<;100:3: else: B: 1: if num>;10 and num<;-10:2: eilf num >;-100 and num<;100:3: else: C: 1: if num>;-10 and num<;10:2: eilf num <;-100 and num>;100:3: elif: D: 1: if num>;-100 and num<;100:2: eilf num >;-10 and num<;10:3: else:
- 定义整型数组num,有两个元素,这个数组的第二个元素是: A: num(2) B: num(1) C: num[1] D: num[2]
- 下列程序的输出结果是() 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)
- 中国大学MOOC: 执行如下代码片段后,num的值为:int num = 5;num = (num % 2) == 0 ? num – 1 : num + 1;