tags:

views:

45

answers:

1

i have question how write program which calculates following procedures

http://en.wikipedia.org/wiki/Tetration

i have exponential program which returns x^n here is code

public class Exp{
public static long  exp(long x,long n){
   long t=0;
 if (n==0){
     t= 1;
}
else{
       if (n %2==0){
   t=  exp(x,n/2)* exp(x,n/2);

}
else{

 t= x*exp(x,n-1);
}

}
 return t;
}


public static  void main(String[]args){
long x=5L;
long n=4L;
 System.out.println(exp(x,n));


}
}

but how use it in Tetration program?please help

+4  A: 
KennyTM
thanks KennyTM thank u very much