0
1.0kviews
Write a simple JavaScript example program for Fibonacci Sequence.
1 Answer
0
7views

Program :

<!DOCTYPE html>
<html>
<header><title>Fibonacci Series</title></header>
<body>
<h3>Fibonacci Series</h3>
<script type="text/javascript">
var a=0,b=1;
document.write(a+"<br/>"+b+"<br/>");
var n=10;
for(var i=1;i<=n-2;i++)
{
var c=a+b;
document.write(c);
document.write("<br/>");
a=b;
b=c;
}
</script>
</body>
</html>
Please log in to add an answer.