永发信息网

用VFP解答~编写一个程序,求S=A!+B!+C!,其中A,B,C从键盘输入,

答案:3  悬赏:60  手机版
解决时间 2021-12-16 14:14
  • 提问者网友:
  • 2021-12-15 14:53
编写一个程序,求S=A!+B!+C!,其中A,B,C从键盘输入,阶乘分别利用自定义函数和过程两种方法实现。记得是两种方法哦~! 步骤要详细一些,谢谢!注明函数 和过程两种方法
最佳答案
  • 五星知识达人网友:duile
  • 2021-12-15 16:01
我只给你写一种,第二种你自己改吧
clear
input "请输入a:" to a
input "请输入b:" to b
input "请输入c:" to c

s=fa(a)+fa(b)+fa(c)
?"a!+b!+c!=", s
return

proc fa
para x
p=1
for i=1 to x
p=p*i
endfor
return p
endproc
全部回答
  • 1楼网友:你是病根
  • 2021-12-15 18:02
input "A=" to a input "B=" to a input "C=" to a s=jc(a)+jc(b)+jc(c) print s *这句好象有问题,我忘记最简单的输出语句是什么了,几种语言容易搞在一起。 proc jc para n s1=1 for i=2 to n s=s*i endfor retu s1
  • 2楼网友:梦里花落
  • 2021-12-15 17:34
input "数字a:" to a do while a<1 &&当输入的数字小于1,失去意义 input "数字a:" to a enddo input "数字b:" to b do while b<1 input "数字b:" to b enddo input "数字c:" to c do while c<1 input "数字c:" to c enddo a=int(a) b=int(b) c=int(c) csum=0 t=1 for i=1 to a t=t*i endfor csum=csum+t t=1 for i=1 to b t=t*i endfor csum=csum+t t=1 for i=1 to c t=t*i endfor csum=csum+t ?csum
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯