帮忙做下这个VF编程题,速求:输入N的值,若为奇数,求s=0.5*(1*2*3...*n);若为偶数,求s=0.5*(1+2+3+...+

问题描述:

帮忙做下这个VF编程题,速求:输入N的值,若为奇数,求s=0.5*(1*2*3...*n);若为偶数,求s=0.5*(1+2+3+...+

clear
input "请输入N的值:" to n
if n%2=0
k=0
for i=1 to n
k=k+i
endfor
else
k=1
for i=1 to n
k=k*i
endfor
endif
s=0.5*k
"s=",s