BuiltWithNOF
Recursion

<html>
 <!-- stats.html                               Dave Reed -->
 <!-- This page simulates dice rolls and maintains stats. -->
 <!--------------------------------------------------------->

<head>
  <title> Dice Stats </title>
  <script type="text/javascript"
         src="http://www.prenhall.com/reed/random.js">
  </script>
  <script type="text/javascript">


     function fibbo(num)  {
           if (num<3)  return 1
           else return fibbo(num-1) + fibbo(num-2);
     }

     function Start(n)  {
           n = parseInt(n);
           document.FibboForm.output.value= fibbo(n);
     }
    
  </script>
</head>

<body>
  <div style="text-align:center">
   <h2>Find Fibbo numbers</h2>

   <form name="FibboForm">
   Which fibbo number do you want?
   <input type="text" name="reps" size=6 value=0 />
   <br /><br />
   <input type="button" value="Click to find this fibbo number" onClick="Start(document.FibboForm.reps.value);"/>
   <br /><br />

     <input type="text" name="output" size=6 value=0 />
   <br /><br />

   </form>
  </div>
</body>
</html>
 

[Home] [Syllabus] [Sessions] [Writing Code] [Help] [Setup] [Instructor]