public class Factorial{
static int factorial(int n){
int return_val;
Trace.reverseIndent(n,
"entering factorial("+n+")");
if (n<0)
throw new IllegalArgumentException("factorial("+n+") undefined");
if (n<=1)
return_val=1;
else
return_val=n*factorial(n-1);
Trace.reverseIndent(n,
"factorial(" +n+")="+ return_val);
return return_val;
}
public static void main(String [] args){
System.out.println(factorial(6));
}
}
//