

public class ex12
{

public static double pow(double x,int n) 
{  
if( n <= 1 )  {return x;} 
else {return x * pow(x,(n-1));}  
}  

 

 // main method begins execution of Java application
 public static void main( String args[] )
 {
 double x=2; 
 int n=5;
 System.out.println(x+"^"+n+" = " + pow(x,n) ); 
 } // end method main

} // end class BPIH5E15
