教学用[阶乘及阶乘之和]

80酷酷网    80kuku.com

  <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 & "
"
    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>

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: