Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Returns an approximation of Pi.
var calcPi = function() { var n = 20000; var pi = 0; for (var i = 0; i < n; i++) { var temp = 4 / (i*2+1); if (i % 2 == 0) { pi += temp; } else { pi -= temp; } } return pi; } print(calcPi());
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
JS exam part 2 - Missing Number
123
JS exam part 2 - Find the property
zeroMatrix
rstring
Mreee
новинка
Константа круга
123141242342
9
Please log in to post a comment.