2,计算下式的值:1+1/2!+1/3!+1/4!+1/5!+...,直到某项的值
问题描述:
2,计算下式的值:1+1/2!+1/3!+1/4!+1/5!+...,直到某项的值
vb
答
Private Sub Command1_Click()n=inputbox("请输入n:")Dim a As integera = 1Dim sum As DoubleFor i = 1 To n For j = 1 To i a = a * j Next sum = sum + 1 / a a = 1NextPrint sumEnd Sub不对