topical media & game development
lib-js-math-calculator-fibonacci.htm / htm
<!-- TWO STEPS TO INSTALL FIBONACCI:
1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Julian Rivera Pineda (xtecuan@secureroot.com) -->
<!-- Web Site: http://xtecuan.8m.com -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
function f(n) {
var s = 0;
if(n == 0) return(s);
if(n == 1) {
s += 1;
return(s);
}
else {
return(f(n - 1) + f(n - 2));
}
}
function show(n) {
var i;
for(i = 0; i <= n; i++) {
f1.s.value += " " + f(i);
}
}
// End -->
</script>
</HEAD>
<!-- STEP TWO: Copy this code into the BODY of your HTML document -->
<BODY>
<form name=f1>
Computations: <input type=text size=4 name="n">
<input type=button value="Compute" onClick="show(f1.n.value);">
<input type=reset value="Reset"><br>
Sequence: <input type=text size="100" name="s">
</form>
<p><center>
<font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
<!-- Script Size: 1.24 KB -->
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.