Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ComputeFact
- {
- /**
- A method to compute n factorial (n!) recursively
- @param n a number >= 0
- @return the value of n!
- */
- public static int factorial(int n)
- {
- if(n == 0){return 1;}
- return n * factorial(--n);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement