Private Function fact(n As Integer) As Integer fact = 1 Do While n > 0 fact = fact * n n = n - 1 LoopEnd FunctionPrivate Sub Form_Click() Dim sum As Integer,i As Integer For i = 4 To 1 Step -1 sum = sum + fact(i) Next Print "Sum="; sumEnd Subsum=24,
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/25 13:36:19
Private Function fact(n As Integer) As Integer fact = 1 Do While n > 0 fact = fact * n n = n - 1 LoopEnd FunctionPrivate Sub Form_Click() Dim sum As Integer,i As Integer For i = 4 To 1 Step -1 sum = sum + fact(i) Next Print "Sum="; sumEnd Subsum=24,
Private Function fact(n As Integer) As Integer fact = 1 Do While n > 0 fact = fact * n n = n - 1 LoopEnd FunctionPrivate Sub Form_Click() Dim sum As Integer,i As Integer For i = 4 To 1 Step -1 sum = sum + fact(i) Next Print "Sum="; sumEnd Sub
sum=24,我不太理解
Private Function fact(n As Integer) As Integer fact = 1 Do While n > 0 fact = fact * n n = n - 1 LoopEnd FunctionPrivate Sub Form_Click() Dim sum As Integer,i As Integer For i = 4 To 1 Step -1 sum = sum + fact(i) Next Print "Sum="; sumEnd Subsum=24,
我没算出来 这个是vb里的吗