

public class ex11
{

public static long factorial(int x) 
{  
if( x <= 1 )  
return 1; 
else 
return x * factorial( x - 1);  
}  

 

 // main method begins execution of Java application
 public static void main( String args[] )
 {
 int x=5; 
 System.out.println(x+" factorial:" + factorial(x) ); 
 } // end method main

} // end class BPIH5E15
