function sum(byval n as integer) as integer
dim i as integer, s as integer
s = 0
for i = 1 to n
s = s + i
next
sum = s
end function
sub main ()
dim n as integer, i as integer, s as integer
inputbox n
s = 0
for i = 1 to val(n)
s = s + sum(i)
next
messagebox s, 0
end sub
温馨提示:答案为网友推荐,仅供参考