-
-
Save oca159/6444621a262564ac7e1c to your computer and use it in GitHub Desktop.
This file contains 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 Catalan(int n) | |
{ | |
if (n <= 0) | |
return 1; | |
else | |
return (2 * (2*n - 1) * Catalan(n - 1)) / (n + 1); | |
} | |
int main() | |
{ | |
cout << "\n Numeros de catalan \n\n"; | |
int n ; | |
cout << "Ingrese numero: "; | |
cin >> n; | |
cout << endl << endl; | |
for(int i=0; i<n; i++) | |
{ | |
cout << Catalan(i); | |
cout <<", "; | |
} | |
system("pause"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment