Fibonacci Series in JavaScript

Learn how to find fibonacci series in javascript

<html>
<body>
<script type=”text/javascript”>

var a=1;
var b=1;

var c;

var i;

document.write(” “+a+” “+b+” “);
for(i=1;i<10;i=i+1)
{
c=a+b;
document.write(c+” “);
a=b;
b=c;
}

</script>
</body>
</html>

 

 

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.