有关VFP的编程

来源:百度知道 编辑:UC知道 时间:2024/05/19 15:19:26
编写程序:1!+2!+3!+......+n!

x=0
y=1
input "请输入一个数字:" to m
for n=1 to m
y=y*n
x=x+y
endfor

?'1!+2!+...+n!=',x

clear
input "N=" to n
W=""
s=0
for i=1 to n
t=1
for j=1 to i
t=t*j
endfor
s=s+t
if i=n
w=w+allt(str(i))+"!="
else
w=w+allt(str(i))+"!+"
endif
endfor
? w+allt(str(s))