S=1+(1+2)+(1+2+3)+……+(1+2+3+……+10)vfp编程。

如题所述

先找规律, 有n项(这里n=10)相加, 每个项又是累加, 使用嵌套循环. 参考代码:
clear
s1=0
for i=1 to 10
s2=0
for j=1 to i
s2=s2+j
endfor
s1=s1+s2
endfor
?s1
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答