1!+3!+5!+7!+9!用asp编写代码是什么?
来源:百度知道 编辑:UC知道 时间:2024/09/26 13:51:36
1!+3!+5!+7!+9!asp代码是什么?
楼上的错了。他要的应该是阶乘。
<%
function ex(i)
t=0
for a=1 to i
t=t*a
next
end function
s=0
For a1=1 to 9 step 2
s=s+ex(a1)
next
response.write s
'response.write ex(1)+ex(3)+ex(5)+ex(7)
%>
以上为实现方法。
有两种输出。代码为手写,没有条件在机器上测试。可能有些小错误,但大体上是这样子。
<%
SumNum = 1+3+5+7+9
Response.Write SumNum
Response.End
%>