VB 循环结构题目

问题描述:

VB 循环结构题目
用for……to……step语句计算:1/1+1/(2!)+1/(3!)+1/(4!)
+……1/(n!)

当N较大时,N!会出错.
请看:
Dim i As Long
Dim sinTemp As Single
Dim sinSum As Single
sinSum = 1#
sinTemp = 1#
For i = 1 To 10 '00
sinTemp = sinTemp / i
sinSum = sinSum + sinTemp
Next i
Print sinSum