SHARE
TWEET

Untitled

venipi4a Oct 23rd, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.              }
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