Advertisement
advictoriam

Untitled

Jan 15th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.27 KB | None | 0 0
  1. public class ComputeFact
  2. {
  3.    /**
  4.       A method to compute n factorial (n!) recursively
  5.       @param n a number >= 0
  6.       @return the value of n!
  7.    */
  8.    public static int factorial(int n)
  9.    {
  10.       if(n == 0){return 1;}
  11.       return n * factorial(--n);
  12.    }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement