Source Code

<!-- Recursive Functions -->

<html>
<
head>
<
title>Recursive Functions</title>
<
/head>
<
body>

<script language="Javascript">
<!-- HIDE FROM OTHER BROWSERS
function factorial(number)
{
    if(number>1)
    {
        return number * factorial(number-1);
    }
    else
        return number;
}
var num=prompt("Enter a number to find Factorial",1);
var ans=factorial(num);
alert("factorial "+ans);
//STOP HIDING-->

</script>

</body>
<
/html>

 

 

Send mail to santhosh_emids@yahoo.com with questions or comments about this web site.
Last modified: November 12, 2000