SHARE
TWEET

Untitled

advictoriam Jan 15th, 2019 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top