Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

fibonacci_javascript

<!DOCTYPE html>
<html>
<title>Web Page Design</title>
<head>
<script>
function sayHello() {
   document.write("Hello, Coding Ground!");
}
sayHello();

/*var add = function()
{  var i, sum = 0;
  for (i=0; i< arguments.length; i++)
 {  sum += arguments[i];
  }
  return sum;
}

document.write("<br>" + add(1,2,3,4,4566));

function fibonacci(n)
{
    var i = 1;
    var j = 1;
    var k = 0;
    document.write (i "<br>" );
    document.write (j "<br>" );
    for (a = 1, a <= n-2, a++){
        k = j + i;
        i = j ;
        j = k;
    document.write(k + "<br>");    
    }
}

fibonacci(5);
</script>
</head>
<body>
</body>
</html>

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.