我需要创建一个计算公式的函数:
Sigma(1/b^i) i...n
它要求用户填写i和n
这是我到目前为止所做的:
b = InputBox("give your calue for b")
n = InputBox("give your value for n")
For i = 1 To n
answer = (1 / (b ^ i))
Next i
MsgBox ("" & answer)
目前它只提供最后一次迭代。如何将所有迭代添加到一起?
我希望有人能帮助我。
答案 0 :(得分:0)
可能像
dim i, b, n, answer
b = InputBox("give your calue for b")
n = InputBox("give your value for n")
answer = 0 'initialization
For i = 1 To n
answer = answer + (1 / (b ^ i))
Next
MsgBox (answer)