diff options
author | EliteTK <tomasz.kramkowski@gmail.com> | 2014-07-10 22:36:56 +0100 |
---|---|---|
committer | EliteTK <tomasz.kramkowski@gmail.com> | 2014-07-10 22:36:56 +0100 |
commit | b60441758f9832a67f60e51a4ee92d16b166b9fb (patch) | |
tree | 7388adc9743181457834cc5eed95e3c452266ab0 /ack.c | |
parent | a26f2837166f7232d13322e013883ed003d46f27 (diff) | |
parent | a8609ccd901b1942e862c14205026d841e640add (diff) | |
download | c-stuff-b60441758f9832a67f60e51a4ee92d16b166b9fb.tar.gz c-stuff-b60441758f9832a67f60e51a4ee92d16b166b9fb.tar.xz c-stuff-b60441758f9832a67f60e51a4ee92d16b166b9fb.zip |
Merge branch 'master' of https://github.com/EliteTK/c-stuff
Conflicts:
xcb.c
Diffstat (limited to 'ack.c')
-rw-r--r-- | ack.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -0,0 +1,21 @@ +#include <stdio.h> + +int ack(m, n) +int m, n; +{ + int ans; + if (m == 0) ans = n + 1; + else if (n == 0) ans = ack(m - 1, 1); + else ans = ack(m - 1, ack(m, n - 1)); + return (ans); +} + +int main(argc, argv) +int argc; char **argv; +{ + int i, j; + for (j = 0; i <= 5; i++) + for (j = 0; j <= 5; j++) + printf("ackerman(%d, %d) is: %d\n", i, j, ack(i, j)); + return 0; +} |