JavaScript code using recursive Functions
JavaScript code using recursive Functions
<html>
<body>
<script>
function factorial(n) {
if (n <= 0)
return 1 ;
else
return n * factorial(n - 1) ;
}
document.writeln(factorial(5)) ;
</script>
</body>
</html>
<body>
<script>
function factorial(n) {
if (n <= 0)
return 1 ;
else
return n * factorial(n - 1) ;
}
document.writeln(factorial(5)) ;
</script>
</body>
</html>
Comments
Post a Comment