用VB语言做程序,输入一个自然数n,求 n!,同时统计结果中有多少个0。

2024-11-20 03:30:12
推荐回答(1个)
回答(1):

Private Sub Command1_Click()
Dim n As Integer, i As Integer, bb As String
n = InputBox("请输入n")
bb = 1
For i = 1 To n
bb = bb * i
Next
Print bb
For i = 1 To 9
bb = Replace(bb, CStr(i), "")
Next i
Print "共有" & Len(bb) & "个0"
End Sub