Skip to content

Instantly share code, notes, and snippets.

@yangg
Created March 16, 2012 08:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yangg/2049176 to your computer and use it in GitHub Desktop.
Save yangg/2049176 to your computer and use it in GitHub Desktop.
Print PI
#include <stdio.h>
#define A(x) x;x;x;x;x;x;x;x;x;x;
int main (void)
{
int n = 1;
A(A(A(printf ("%d ", n++))));
return 0;
}
int a=10000,b,c=2800,d,e,f[2801],g;
main(){
for(;b-c;)f[b++]=a/5;
for(;d=0,g=c*2;c-=14,printf("%.4d",e+d/a),e=d%a)
for(b=c;d+=f[b]*a,f[b]=d%--g,d/=g--,--b;d*=b);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment