Switch to full style
JSP Code Examples
Post a reply

factorial number Using Recursion

Thu Jan 15, 2009 11:35 pm

Using Recursion in JSP .Here i get a factorial of a number using recursion .
Code:
<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>
 




Post a reply
  Related Posts  to : factorial number Using Recursion
 code to find a number all divisors using recursion     -  
 Get Factorial using Java     -  
 C++ Recursion Sort     -  
 Function Recursion     -  
 Fibonacci vs factorial     -  
 recursively calculating factorial     -  
 convert integer number to octal,hexadecimal number systems     -  
 convert octal number to decimal number     -  
 convert decimal number to octal number     -  
 Number with dot in php     -  

Topic Tags

Servlets/JSP