求VB代码:计算1+3!+5!+7!+9!+11!
3个回答
展开全部
40284847就是最后结果,代码如下。
Private Sub Command1_Click()
s = 0
For i = 1 To 11 Step 2
x = 1
If i = 1 Then
x = i
s = s + x
ElseIf i > 1 Then
For j = 1 To i
x = x * j
Print x
Next j
s = s + x
End If
Next i
MsgBox "1+3!+5!+7!+9!+11!=" & s
End Sub
Private Sub Command1_Click()
s = 0
For i = 1 To 11 Step 2
x = 1
If i = 1 Then
x = i
s = s + x
ElseIf i > 1 Then
For j = 1 To i
x = x * j
Print x
Next j
s = s + x
End If
Next i
MsgBox "1+3!+5!+7!+9!+11!=" & s
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
那样的答案都能上推荐答案,我真是无语了。。。。
Private Sub Form_Click()
Dim s&, i%, jc&
jc = 1
For i = 1 To 11
jc = jc * i
If i Mod 2 Then s = s + jc
Next
MsgBox "1+3!+5!+7!+9!+11!=" & s
End Sub
Private Sub Form_Click()
Dim s&, i%, jc&
jc = 1
For i = 1 To 11
jc = jc * i
If i Mod 2 Then s = s + jc
Next
MsgBox "1+3!+5!+7!+9!+11!=" & s
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
sum=1
for i=1 to 11 step 2
if i>1 then
for j=2 to i
sum=sum*j
next
sum+=sum
end if
next
response.write sum
for i=1 to 11 step 2
if i>1 then
for j=2 to i
sum=sum*j
next
sum+=sum
end if
next
response.write sum
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询