# Program for solution of function problems using Recursive function.

/*******************************************************
PROGRAM TO CALCULATE A(x,y) WHERE
= y+1 IF x=0
A(x,y) = A(x-1,1) IF y=0
= A(x-1,A(x,y-1)) OTHERWISE

PROGRAM USES THE RECURSION TECHNICHE. THE RECURSION IS MINIMIZED TO SOME EXTENT
*******************************************************/

```#include<stdio.h>            //HEADER FILES INCLUDED HERE
#include<math.h>            //THIS ONE IS FOR  pow()
long int acker(int,int);    //FUNCTION PROTOTYPE DEFINITION
main()
{
int x,y;            //LOCAL VARIABLES x AND y
l: printf("nnENTER THE TWO OPERANDS x AND y (only +ve)::");//READING VALUES OF x AND y
scanf("%d%d",&x,&y);
if((x<0||y<0)||(x%1||y%1)) //CHECKING WHETHER THE VALUES ARE +ve INTEGRAL
{
printf("ENTER POSITIVE VALUES");
goto l;
}                                       //FUNCTION ACKER IS CALLED WITH x AND y AND..
printf("A(%d,%d)=%ldn",x,y,acker(x,y));    //..RESULT PRINTED
}
long int acker(int a,int b)                  //acker FUNCTION DEFINED HERE
{                                    //FORMAL PARAMETERS ARE a AND b
int i,value=5;                           //LOCAL VARIABLES TO acker
if(!a)                        //CASE OF a=0
return(b+1);
else if(a==1)                    //CASE OF a=1
return(b+2);
else if(a==2)                    //CASE OF a=2
return(2*b+3);
else if(a==3&&b)                      //CASE OF a=3
{
for(i=3;i<=b+2;i++)
value+=pow(2,i);
return(value);
}
else if(!b)                         //CASE OF b=0
return(acker(a-1,1));
else                             //OTHER CASES HANDLED BY RECURSION
return(acker(a-1,acker(a,b-1)));
}```