Using Recursion
Using Recursion
<%!
int factorial(int n)
{
if (n == 1) {
return n;
}
else {
return n * factorial(n - 1);
}
}
%>
<%
out.println("The factorial of 6 is " + factorial(6));
%>