Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java recursion

public static long factorial(int n) { 
    if (n == 1) return 1; //base case
    return n * factorial(n-1); 
}
Source by introcs.cs.princeton.edu #
 
PREVIOUS NEXT
Tagged: #java #recursion
ADD COMMENT
Topic
Name
5+1 =