*/ This program calculates the value of Ackerman function A(x,y) n0n-recursively; written in "C" by Anilkumar C.D. on 8th Aug 2008 It uses 2 functions ack_11 and ack_12. Increase the capacity of the array X1[n] for higher values of x and y, and here the array size is "100", as it's a safe value for the computer/* #include void main() { int x,y,p,q; int ack_11(int x, int y); int ack_12(int x, int y); int total = 0; printf("Enter va;ues of x and y : "); scanf("%d %d",&x,&y); p=x;; q=y; if (x>=1 && y>=1) total=ack_11(x,y); else if(x>0 && y==0) total=ack_12(x,y); else total=y+1; printf(" \n A( %d, %d )= %d ",p,q,total); } int ack_11(int x, int y) { int n, x1[100];// array x1[n] initialized for 100 values(increase it if result is wrong) int total; n=1; for (;x;) { x1[n]=x-1; y--; n++; if (y==0) { x--; y++; if(x==1) { y=y+2; n--; } else if(x==0) { n--; y++; while(x1[n]==0 && n>1) { y++; n--; x=x1[n]; } } } } total=y+1; return(total); } int ack_12(int x, int y) { int n, x1[100]; int total; n=1; y++; for (;x;) { if (x==1) { total=y+1; x--; } else { x--; for (;x;) { x1[n]=x-1; n++; y--; if (y==0) { x--; y++; if(x==1) { y=y+2; n--; } else if(x==0) { n--; y++; while(x1[n]==0 && n>1) { y++; n--; x=x1[n]; } } } } } } total=y+1; return(total); }