Advertisement
Telor_Goreng0

nomor 1 pertemuan 4

Apr 24th, 2021
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. package pertemuan4;
  2. public class nomor1 {
  3. static int ack(int m, int n) {
  4. if (m == 0)
  5. {return n + 1;}
  6. else if((m > 0) && (n == 0))
  7. {return ack(m - 1, 1);}
  8. else if((m > 0) && (n > 0))
  9. {return ack(m - 1, ack(m, n - 1));}
  10. else
  11. return n + 1;
  12. }
  13. public static void main(String args[])
  14. {
  15. System.out.println(ack(2, 9));
  16. }
  17. }
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement