回 帖 发 新 帖 刷新版面

主题:还有求1!+2!+......+10!的,请看看.谢谢.

(1)用FOR -NEXT
CLS
m=1
sum=0
FOR n=1 TO 10
m=m*n
sum=sum+m
next n
print sum
END
(2)用DO-LOOP UNTIL
CLS
m=1
n=1
sum=0
DO
m=m*n
n=n+1
sum=sum+m
LOOP UNTIL n>10
PRINT sum
END

回复列表 (共23个回复)

沙发

看了

板凳

cls
s=0
for n= 1 to 10
gosub L   (用块内子程序编)
s=s+t
next n
print "s=";s
end

L:t=1
for i=1 to n
t=t*i
next i
return[size=4]用块内子程序编的[/size]

3 楼

b=1
for a=1 to 10
b=b*a
c=c+b
next a
print c
end
这样多简单啊,象你们编的一大堆看都懒的看

4 楼

input n
p=1
s=0
for i=1 to n
for j=1 to i
  p=p*j
next j
s=s+p
next i
print s

5 楼

我认为第四楼的方法是错误的,第五楼好像正确一些

6 楼

3楼的“C”不用初始值吗?[em18]

7 楼

我的方法:(不知道对不对?算出来是55)
dim i,sum as integer
Cls
Sum = 0
For n = 1 To 10
  Sum = Sum + n
Next n
Debug.Print Sum
print sum
End

8 楼

Cls
a=1+2+3+4+5+6+7+8+9+10
Print a
End

9 楼

10 楼

   t=1
   for i= 1 to 10
   t=t*i
   s=s+t
   next i
   print   s
   end
这个不是也很简单吗 干吗弄的那么复杂呢![font=楷体_GB2312][/font][color=808080][/color]

我来回复

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