Skip to content

Commit b4743f8

Browse files
authored
Merge pull request #34 from ruthud/ruthu
Add program
2 parents 70b983b + 0d88c1d commit b4743f8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

C/program-40/program.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*Write a C program to find the Ackermann of 2 Numbers*/
2+
3+
#include<stdio.h>
4+
int ack(int m,int n)
5+
{
6+
if(m==0)
7+
return n+1;
8+
else if(m!=0 && n==0)
9+
return ack(m-1,1);
10+
else if (m!=0 && n!=0)
11+
return ack(m-1,ack(m,n-1));
12+
}
13+
14+
int main()
15+
{
16+
int a,b,c;
17+
printf("Enter 2 Elements:\n");
18+
scanf("%d%d",&a&b);
19+
c=ack(a,b);
20+
printf("Ackermann(%d,%d)=%d",a,b,c);
21+
return 0;
22+
}

0 commit comments

Comments
 (0)