(String[] args)
| 3 | |
| 4 | public class ackermann { |
| 5 | public static void main(String[] args) { |
| 6 | int num = Integer.parseInt(args[0]); |
| 7 | System.out.println("Ack(3," + num + "): " + Ack(3, num)); |
| 8 | } |
| 9 | public static int Ack(int m, int n) { |
| 10 | return (m == 0) ? (n + 1) : ((n == 0) ? Ack(m-1, 1) : |
| 11 | Ack(m-1, Ack(m, n - 1))); |