分类：电脑/网络-程序设计
问题：vb问题，急编写程序，计算并输出下面数列前n项和（设n=20，接 
编写，计算并输出下面数列前n项和（设n=20，接过取4位小数）。数列为2/1，3/2，5/3，8/5，13/8，21/13......
回答：Dim sum as Single, a as Single, b as Single, tmp as Single

sum = 0
a = 2
b = 1

For i = 1 to 20
sum = sum + a / b
tmp = a
a = a + b
b = tmp
Next i