用vb求1到n的阶乘和的程序编写
展开全部
private
sub
command1_click()
dim
x
as
integer,
s
as
long,
y
as
integer,
sum
as
long
x
=
inputbox("请输入小于13的数据",
"输入数据",
0)
s
=
1
sum
=
0if
x
>=
13
then
msgbox
("请重新输入小于13的数据")
end
iffor
i
=
1
to
x
s
=
s
*
i
'计算阶乘的算法
sum
=
sum
+
s
累加求和的算法
next
i
print
sum
end
sub
sub
command1_click()
dim
x
as
integer,
s
as
long,
y
as
integer,
sum
as
long
x
=
inputbox("请输入小于13的数据",
"输入数据",
0)
s
=
1
sum
=
0if
x
>=
13
then
msgbox
("请重新输入小于13的数据")
end
iffor
i
=
1
to
x
s
=
s
*
i
'计算阶乘的算法
sum
=
sum
+
s
累加求和的算法
next
i
sum
end
sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询