用VFP设计程序,求s=1+(1+2)+(1+2+3)+...+(1+2+3+...+n)的值

设计程序,求s=1+(1+2)+(1+2+3)+...+(1+2+3+...+n)的值输入一个n输出一个S

新建一个程序(文件菜单——新建——程序——新建文件),写代码: input "请输入n的值:" to n
s=0
temp=0
for i=1 to n
temp=0
for j=1 to i
temp=temp+j
next
s=s+temp
next
?"s=1+(1+2)+(1+2+3)+...+(1+2+3+...+n)的值是:",s
然后,直接点击感叹号,保存并运行,图:
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答