/* * Problem 1, Lab 10, Wednesday 29th October * program to print a table on the terminal showing values of A(i, j) for 1 <= i,j <= 5 */ class Ackerman { public static void main(String args[]) { for (int i=0;i<=5;i++) { for (int j=0;j<=5;j++) { System.out.println("A("+i+","+j+") = " + A(i,j)); } } } public static int A(int m, int n) { if(m == 0) return n+1; if(m>0 && n==0) return A(m-1,1); return A(m-1,A(m,n-1)); } }