Advertisement
venipi4a

Untitled

Oct 23rd, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. static int factorial(int n){
  2. if (n == 0)
  3. return 1;
  4. else
  5. return(n * factorial(n-1));
  6. }
  7. public static void main(String args[]){
  8. int i,fact=1;
  9. int number=6;
  10. fact = factorial(number);
  11. System.out.println("Factorial of "+number+" is: "+fact);
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement