Skip to content

Instantly share code, notes, and snippets.

@onnyyonn
Last active December 14, 2015 21:19
Show Gist options
  • Save onnyyonn/5150266 to your computer and use it in GitHub Desktop.
Save onnyyonn/5150266 to your computer and use it in GitHub Desktop.
Print up to 34th Catalan no.
#include <stdio.h>
int main()
{
float n=0.0, cat=1.0;
while(n<=33)
{
cat = 2*(2*n+1)/(n+2)*cat;
n++;
printf("Catalan no. %2.0f is %1.0f\n",n,cat);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment