Thu Jan 15, 2009 11:35 pm
<HTML>
<HEAD>
<TITLE>Recursion</TITLE>
</HEAD>
<BODY>
<H1>factorial number Using Recursion</H1>
<%!
int numberfactorial(int number)
{
if (number == 1) {
return number;
}
else {
return number * numberfactorial(number - 1);
}
}
%>
<%
out.println("The factorial of 5 is " + numberfactorial(5));
%>
</BODY>
</HTML>
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.