-
-
Save oca159/359385b473739d960f86 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <cstdlib> | |
| using namespace std; | |
| int Ackerman(int m, int n) | |
| { | |
| if(m==0) | |
| return n+1; | |
| else | |
| { | |
| if(n==0) | |
| return Ackerman(m-1, 1); | |
| else | |
| return Ackerman(m-1, Ackerman(m, n-1)); | |
| } | |
| } | |
| int main() | |
| { | |
| int m, n, num ; | |
| cout<<"\n FUNCION DE ACKERMAN \n\n"; | |
| cout<<"Ingrese <m>: "; | |
| cin>> m ; | |
| cout<<"Ingrese <n>: "; | |
| cin>> n ; | |
| num = Ackerman(m,n); | |
| cout<<"\nEl numero es: "<< num <<endl<<endl; | |
| system("pause"); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment