要使变量x赋值为1~100间(含1,不含100)的一个随机整数,正确的语句是()
A: x=Int(100*RnD)
B: x=Int(101*RnD)
C: x=1+Int(100*RnD)
D: x=1+Int(99*RnD)
A: x=Int(100*RnD)
B: x=Int(101*RnD)
C: x=1+Int(100*RnD)
D: x=1+Int(99*RnD)
举一反三
- 要使变量x赋值为[50~100]间的一个随机整数,正确的语句是()。 A: x=INT(100*RND) B: x=INT(101*RND) C: x=INT(50*RND+50) D: x=INT(51*RND+50)
- 使用数组x输出10个1-100之间的随机整数(包括1和100),下列命令中正确的是:( ) A: Dim x(9) As Integer For i = 1 To UBound(x) x(i) = Int(Rnd() * 100 + 1) Print x(i); Next B: Dim x(9) As Integer For i = 0 To UBound(x) x(i) = Rnd(10) Print x(i); Next C: Dim x(9) As Integer For i = 0 To UBound(x) x(i) = Int(Rnd() * 100 ) Print x(i); Next D: Dim x(9) As Integer For i = 0 To UBound(x) x(i) = Int(Rnd() * 100 + 1) Print x(i); Next
- x,y是整数型变量,z产生一个范围在[y,x]之间的随机整数的语句是()。 A: z=Int(Rnd*(y-x+1))+x B: z=Int(Rnd*y) + x C: z=Int(Rnd*x)+y D: z=Int(Rnd*(y-x)) + x
- 能够产生一个三位随机整数的函数表达式是()。 A: Int(Rnd*900+100) B: Int(Rnd*900)+100 C: Int(Rnd*1000) D: Int(Rnd*1100-100) E: Int(Rnd*1100)-100
- x,y是整数型变量,在VBA中产生一个范围在[x,y]之间的随机整数z的语句是( ) A: z=Int(Rnd*y)+x B: z=Int(Rnd*(x-y+1)+y) C: z=Int(Rnd*(y-x+1)+x) D: z=Int(Rnd*x)+y