mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-29 22:50:47 +00:00
b7e711838f
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@908 91177308-0d34-0410-b5e6-96231b3b80d8
24 lines
425 B
C
24 lines
425 B
C
/* -*- mode: c -*-
|
|
* $Id$
|
|
* http://www.bagley.org/~doug/shootout/
|
|
*/
|
|
|
|
int printf(const char *, int, int);
|
|
int atoi(const char *);
|
|
|
|
int
|
|
Ack(int M, int N) {
|
|
if (M == 0) return( N + 1 );
|
|
if (N == 0) return( Ack(M - 1, 1) );
|
|
return( Ack(M - 1, Ack(M, (N - 1))) );
|
|
}
|
|
|
|
int
|
|
main(int argc, char *argv[]) {
|
|
int n = ((argc == 2) ? atoi(argv[1]) : 5);
|
|
|
|
printf("Ack(3,%d): %d\n", n, Ack(3, n));
|
|
return(0);
|
|
}
|
|
|