set talk on
clear
input "输入数据n:" to n
s=1
if n=0
cancel
else
if n< 0
?"输入数据有误,请重新输入"
for i=1 to n
s=s*i
next
? n,"的阶乘为:",s
endif
set talk off