下面程序段是计算()公式的。s=0:t=1Fori=1To10t=t*is=s+tNexti
A.s=1+2+3+4+5+6+7+8+9+10
B.s=1*2*3*4*5*6*7*8*9*10
C.s=1!+2!+3!+4!+5!+6!+7!+8!+9!+10!
D.s=1+2*3+3*4+4*5+5*6+6*7+7*8+8*9+9*10
第1题:
下面运行程序后,单击命令按钮,输出出的结果是【 】。
Private Sub Command1_Click( )
Dim a% (1 To 5) ,i%, s
For i = 1 To 5
a(i) =i
Next
s = Fun(a)
Print"s="; s;
End Sub
Function Fun(a() As Integer)
Dim t, i%
t=1
For i = LBound(A0To UBound(a)
t=t * a(i)
Next
Fun =t
End Function
第2题:
该程序运行后屏幕显示的结果是__________。
s=1
FORi=1 T0 5 STEP2
s=s+i
ENDFOR
?s
RETURN
第3题:
下面程序段是求π的近似值,当第n项的绝对值小于1e-5时终止计算。 π/4=1-1/3+1/5-1/7+... Dim n As Long, s As Single Dim t As Single, pi As Single n = 1: t = 1: s = 0 Do While abs(t) > ______ s = s + t n = n + 1 t = (-1)^(n + 1)/(2*n-1) Loop
第4题:
下面程序段,运行后的结果是
Private Sub Command1_Click
Dim b%(1 To 4), i%, t#
For i=1 To 4
b(i) =i
Next
t=Tof(b() )
Print "t="; t,
End Sub
Function Tof(a() As Integer)
Dim t#, i%
t=1
For i=2 To UBound(a)
t=t a(i)
Next
Tof=t
End Function
A.t=18
B.t=24
C.t=30
D.t=32
第5题:
下面程序的功能是计算1-3+5-7+ …… -99+101的值。 ① main() { int i,t=1,s=0; for(i=1;i<=101;i+=2) { ① ; s=s+t; ② ; } printf(”%dn”,s}; }
A.t = i * t
B.t = i * (t+1)
C.t = (i+1)* t
D.t = (i-1) * t