回 帖 发 新 帖 刷新版面

主题:各位大虾帮下忙..谢谢

下列程序的功能实:用来求t=1/1!-1/2!+1/3!-1/4!+.......+(-1)^(n+1)/n!的值,n由键盘输入,请仔细阅读程序并在程序“(   )”处填入所需内容.

  10 input n: t=0: n=INT(n)
  if n<0 then goto 10
  for x=1 to n
     p=1
     for y=1 to x
        p=(    )
     next y
        t=(    )
     next x
     print “t=”;t
     end
原来发过类似的题目,但好像鄙人输入有误所以没有解答,对此我非常抱歉,但这次我已认真的对照过了,还请大虾们帮下忙....

回复列表 (共1个回复)

沙发

10 input n: t=0: n=INT(n)
  if n<0 then goto 10
  for x=1 to n
     p=1
     for y=1 to x
        p=(p*y   )
     next y
        t=(t+( (-1)^(x+1)/p)   )
     next x
     print “t=”;t
     end

我来回复

您尚未登录,请登录后再回复。点此登录或注册