Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static double CalcPI()
- {
- double pi = 1;
- for (int i = 3, cnt = 0; i < 100000; i += 2, cnt++)
- {
- if (cnt % 2 == 0)
- {
- pi -= (double)1 / i;
- }
- else
- {
- pi += (double)1 / i;
- }
- }
- pi *= 4;
- return pi;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement