input "请输入项数" to n
if type('n')#'N' or n<1 or int(n)#n
?'输入数据无效'
return
endif
dimension f(n)
f(1)=1
f(2)=2
for i=3 to n+1
f(i)=f(i-1)+f(i-2)
endfor
s=0
for i=1 to n
s=s+f(i)/f(i+1)
enddo
?s
if type('n')#'N' or n<1 or int(n)#n
?'输入数据无效'
return
endif
dimension f(n)
f(1)=1
f(2)=2
for i=3 to n+1
f(i)=f(i-1)+f(i-2)
endfor
s=0
for i=1 to n
s=s+f(i)/f(i+1)
enddo
?s

感言:学以致用。 博客:http://www.bc-cn.net/blog/user14/65009/index.shtml email:Tiger5392@