Theerayut

ret

Dec 1st, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include<stdio.h>
  2. int Ack (int m, int n)
  3. {  
  4.     if (m == 0)
  5.     return n + 1;
  6.     else if (n == 0)
  7.     return Ack (m - 1, 1) ;
  8.     else
  9.     return Ack (m - 1, Ack (m, n - 1) ) ;
  10. }
  11.     void main ( )
  12. {   int m, n;
  13.     printf("m : ");
  14.     scanf("%d",&m);
  15.     printf("n : ");
  16.     scanf("%d",&n);
  17.     printf ("Answer = %d", Ack (m,n) ) ;
  18. }
Add Comment
Please, Sign In to add comment