-
finding pi
i am working on a program that calculates
pi=4*(1-1/3+1/5-1/7+1/9-1/11+1/13+...)
etc i know im going to use a for loop for this because i need 30000 terms to approximate the value
can anybody help me in implementing this? any ideas would help and will be much appreciated
-
Re: finding pi
That's not the way a forum works. Post your best efforts and ask a specific question. Note that "How do I do this?" is non-specific.
Recommended reading:
How To Ask Questions The Smart Way
db
-
Re: finding pi
Sounds like you either need a program to find 30,000 prime numbers or a file with them stored. To start with.....nevermind, they are just odd, not prime?
-
Re: finding pi
Looks that this would do it..
This will do much more than 30,000 terms, but when limited to 30,000 I get
30000: 4*0.7853898300641171 = 3.1415593202564684
-
Re: finding pi
Please do not post full solutions to problems such as this. The intent of these forums is to get folks to try to do things themselves and maybe even learn in the process - either through trial and error and/or trial and success.
gonfreecks, I suggest you attempt writing this code yourself, and if it doesn't work by all means post back with a specific question about the code, what output you expect versus what you get