Ackermann function
#include <iostream>
using namespace std;
int acker(int m, int n);
int main(){
int m = 2, n = 3;
cout << "Ackerman de 2 y 3: " << acker(m, n) << endl;
cin.sync();
cin.get();
return 0;
}
int acker(int m, int n){
if (m == 0) return (n + 1);
else if (n == 0) return acker(m - 1, 1);
return acker(m - 1, acker(m, n - 1));
}






There are currently no comments for this snippet.