教学用[阶乘及阶乘之和]
2011-5-18编辑:lily
<html>
<head>
<title>阶乘输出</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF">
<div align="center"><font color="#FF0000"><b>阶乘输出 </b></font><b></b> </div>
<%
if Request.Form("cal")="y" then
n=Cint(Request.form("me"))
fac=1
S=0
For i=1 to n
fac=fac*i
S=S+fac
Next
Response.Write n & "!=" & fac & "<br>"
Response.Write n&"!的阶乘之和为:" & S
end if
%>
<form method="post" action="try1.asp">
输入数字:
<input type="text" name="me" size="5">
<input type=hidden name=cal value=y>
<input type="submit" name="Submit" value="提交">
</form>
</body>
</html>