<html>
<head>
<title> Menghitung Deret Fibonacci </title>
<script>
<!--
function fibonacci(n){
var i;
var array_fib = new Array();
array_fib.push(0);
array_fib.push(1);
for (i=0; i<n; i++){
array_fib.push(array_fib[0] + array_fib[1]);
array_fib.shift();
}
return array_fib[0];
}
for(i=0; i<=20; i++)
document.write ("fibonacci(" + i + ") = " + fibonacci(i) + "<br>");
//-->
</script>
</head>
<body>
</body>
</html>
Menghitung Deret Fibonacci
Label:
Menghitung Deret Fibonacci
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar