用WHILE语句计算1+1/2!+1/3!+1/4!+...的前20项和
问题描述:
用WHILE语句计算1+1/2!+1/3!+1/4!+...的前20项和
答
a = 1
b = 1
i = 1
While i i = i + 1
b = b * i
a = a + 1 / b
Wend
Debug.Print a
结果:2.71828182845905