求1,1,2,3,5,8,13,21,34...的第N位結果For ASP
来源:互联网 发布:北京网络营销策划公司 编辑:程序博客网 时间:2024/05/21 17:02
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>求1,1,2,3,5,8,13,21,34,......的第N位結果</title>
</head>
<%
'==========================================
'求1,1,2,3,5,8,13,21,34,......的第N位結果
'遞迴方法
'==========================================
on error resume next
Server.ScriptTimeOut=999999 ''處理資料可能需要長時間
a=trim(request("t1"))
if a="" then
response.Write("Please input number in textbox")
else
Response.Write("第"+a+"位的結果是:")
Response.Write(foo(cint(a)))
end if
'递归函数求第N位结果
function foo(a)
if a<=0 then
foo=0
elseif a=1 or a=2 then
foo=1
else
foo=foo(a-1)+foo(a-2)
end if
end function
%>
<form name="form1" method="post" action="">
<input name="t1" type="text" id="t1" size="20">
<input type="submit" name="Submit" FONT-FAMILY: 'PMingLiU','serif'; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">提交">
</form>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>
</head>
<%
'=================
'
'
'=================
on error resume next
Server.ScriptTimeOut=999999 ''
a=trim(request("t1"))
if a="" then
response.Write("Please input number in textbox")
else
Response.Write("
Response.Write(foo(cint(a)))
end if
'递归函数求第N位结果
function foo(a)
if a<=0 then
foo=0
elseif a=1 or a=2 then
foo=1
else
foo=foo(a-1)+foo(a-2)
end if
end function
%>
<form name="form1" method="post" action="">
<input name="t1" type="text" id="t1" size="20">
</form>
- 求1,1,2,3,5,8,13,21,34...的第N位結果For ASP
- 求1,1,2,3,5,8,13,21,34...的第N位結果For ASP
- C# 使用递归求第n个数的值 1,1,2,3,5,8,13,21,n……
- c语言 数列1,1,2,3,5,8,13,21,34...求第n项
- 求 1 1 2 3 5 8这种数列的第n个数 迭代法和递归来求
- 第四周项目5——(2)求1*3*...*n的值
- 序列1,2,2,3,3,3, ... 求第n项的值(n=N*)
- 第四周【求1*3*...*n的递归式】
- 第四周项目五 求1*3*5*7*...*n
- 求1+2+3+4+ + +n 的值(for语句)
- 求特征数列(第n个数是第n-1个数和第n-2个数的和)的第X个数是多少
- 第12周项目3求“1*3*5*...*n”的递归式(递归函数)
- 第12周项目3用递归法求解(2、求1*3*5。。。*n的值)
- 求1*3*5*.......n的值
- 求1+2!+3!+...+N!的和
- 求1+2+3+...+n的和
- 求1+2+3+。。。+n的值
- 计算(1,1,2,3,5,8,13.......N)的第N位的数值
- 如何:查看全局程序集缓存的内容
- JQuery基础
- 排序數據的示例,多个数字用逗号分隔For ASP
- 转帖:linux启动的脉络
- 关于VSS自动登录的问题
- 求1,1,2,3,5,8,13,21,34...的第N位結果For ASP
- 有四种方法可将程序集安装到全局程序集缓存
- 下划线样式的输入框
- 中标软件获两亿注资 成达梦第一大股东
- Iterator的作用以及遍历LinkedList双向链表的效率
- 庆祝blog点击过10w,排名k以内
- S2SH: Can't load mysql driver "com.mysql.jdbc.Driver" 修改Class类
- C# 单词变成复数形式 源码
- Google为developer提供prototype