Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

Fibonacci Series in html

<html>
    <head>
        <script>
          function fib(number) {

    var loop = [0, 1];

    for (var i = 2; i < number; i++) {
        loop[i] = loop[i-1]+ loop[i-2];


    return loop[number-1];
    }

            document.getElementById("output").innerHTML
    }
        </script>

    </head>
    <body>
        <input type text="text" id="txtloop" />
        <input type="button" id="btnEnter" value="Enter" onclick="fib(txtloop.value)" />

        <p id="output"></p>

    </body>
</html>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Fibonacci #Series #html
ADD COMMENT
Topic
Name
5+1 =