编程计算1!+2!+3!+4!+5!+6!+7!+8!+9!+10!的值
7个回答
展开全部
来个vb版本的
function jc(byval n as integer) as long
dim x as long,i as integer
x=1
for i =1 to n
x=x*i
next
jc=x
end function
private sub command1_click()
dim i as integer, x as long
for i=1 to 10
x=x+jc(i)
next
msgbox x
end sub
我是直接打的,不知道有没有错误。。。。。
function jc(byval n as integer) as long
dim x as long,i as integer
x=1
for i =1 to n
x=x*i
next
jc=x
end function
private sub command1_click()
dim i as integer, x as long
for i=1 to 10
x=x+jc(i)
next
msgbox x
end sub
我是直接打的,不知道有没有错误。。。。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
Dim j As Integer, g As Double
For j = 1 To 10
g = g + jc(j)
Next
Print g
End Sub
Public Function jc(ByVal i As Integer)
jc = i
Do While i >= 2
i = i - 1
jc = jc * i
Loop
End Function
Dim j As Integer, g As Double
For j = 1 To 10
g = g + jc(j)
Next
Print g
End Sub
Public Function jc(ByVal i As Integer)
jc = i
Do While i >= 2
i = i - 1
jc = jc * i
Loop
End Function
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询