»
EnglishFrenchVietnamese

Print - Fibonacci - JavaScriptBank.com

Full version: jsB@nk » Calculation » Math » Fibonacci
URL: https://www.javascriptbank.com/fibonacci.html

Fibonacci © JavaScriptBank.comDisplays the Fibonacci Sequence of Numbers as entered by the user. Warning: This is very processor intensive, do not enter a large number.

Full version: jsB@nk » Calculation » Math » Fibonacci
URL: https://www.javascriptbank.com/fibonacci.html



JavaScript
<SCRIPT LANGUAGE="JavaScript">// Julian Rivera Pineda ([email protected]) --><!-- Beginfunction 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><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<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="70" name="s"></form><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->