向日葵的作者:vf程序填空题,请高手们都来帮忙

来源:百度文库 编辑:高校问答 时间:2024/04/29 19:16:00
2、子程序SUB.PRG带有参数P,N,功能是计算P=N!主程序Main.prg读入正整数M和K(K<M),并调用子程序SUB.PRG求出最后输出S的值
*Main.prg
Set talk off
Input’请输入K的值:’to K
Input’请输入K的值:’to M
__________
_________
Do while _______
Do Sub with __________
_____________
i = i+1
______________
? “s=”, s
Set talk on
Return

*sub.prg
___________
Store 1 to P ,L
Do while L<=N
P= __________
L= __________
Enddo
Return

*2、子程序SUB.PRG带有参数P,N,功能是计算P=N!
* 主程序Main.prg读入正整数M和K(K<M),并调用子程序SUB.PRG求出最后输出S的值
*Main.prg
Set talk off
Input '请输入K的值:' to K
Input '请输入M的值:' to M
i = K &&__________
s = 0 &&_________
Do while i<M &&_______
Do Sub with k,i &&__________
s = s+k &&_____________
i = i+1
?K,I
ENDDO &&______________
? "s=", s
Set talk on
Return

*sub.prg
function sub &&这样用是一样的.
parameter P,N &&___________
Store 1 to P ,L
Do while L<=N
P= P*L && __________
L= L+1 &&__________
Enddo
Return

P=p*L
L=L+1