Skip to content

Instantly share code, notes, and snippets.

@mgng
Created October 2, 2009 09:31
Show Gist options
  • Save mgng/199579 to your computer and use it in GitHub Desktop.
Save mgng/199579 to your computer and use it in GitHub Desktop.
円周率を求めるやつ
var n = 1000;
var a = 4;
var b = 1;
for(var i=3,j=0;i<n;i+=2,j++){
b += ((j%2 === 0)?-1:1) * (1/i);
}
var pi = a*b;
alert(pi);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment