0 votes 0 votes int A(int m,int n) { if(!m) return n+1; if(!n) return A(m-1,1); return A(m-1,A(m,n-1)); } int main() { printf("A(1,2)=%d",A(1,2)); } what will be the output and how? AIkiran01 asked Jun 5, 2017 AIkiran01 495 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
1 votes 1 votes Ans is 4 Gate Ranker18 answered Jun 5, 2017 Gate Ranker18 comment Share Follow See all 0 reply Please log in or register to add a comment.
1 votes 1 votes i think 4 will be its ouput... akash.dinkar12 answered Jun 5, 2017 akash.dinkar12 comment Share Follow See all 0 reply Please log in or register to add a comment.
1 votes 1 votes Its a very popular, well known function 'Ackerman function'. the recursive calculation is quite easy. A(1,2)=A(0 , A(1,1))=A(0 , A(0 , A(1,0) ) )=A(0 , A(0 , A(0 , 1) ) )=A(0,A(0,2))=A(0,3)=4 http://www.gfredericks.com/sandbox/arith/ackermann https://www.saylor.org/site/wp-content/uploads/2011/06/Ackermann-Function.pdf Rupendra Choudhary answered Jun 5, 2017 Rupendra Choudhary comment Share Follow See all 0 reply Please log in or register to add a comment.