# Formula for Pi

• 10-11-2003
zowen
Formula for Pi
What is the formula for Pi that I can use in C++?
• 10-11-2003
velius
Pi is a constant of 3.1415926535897932384626433832795 which is usually labeled as 3.14. There would be no formula for that.
• 10-11-2003
Dante Shamest
An approximation would be 22/7.
• 10-11-2003
zowen
no..there is definitely a formula.
• 10-11-2003
Dave_Sinkula
There is this, but in C I might do something like the following.
Code:

`double pi = 4.0 * atan(1.0);`
• 10-11-2003
curlious
Did you try a search on google.

Here is one link.
PI
• 10-11-2003
joshdick
There are plenty of ways to calculate Pi. When you get to Calc 3, you'll learn about series and use them to find approximations for Pi and e. If you just need to use Pi in a program, declare PI as a constant that has as many decimal places as you want of accuracy.
• 10-12-2003
Shiro
There are many ways to calculate pi. Note that if you want to calculate pi during the running of your program, this may be very inefficient. Better would be to store pi as a constant and use that constant. Ofcourse you'll always work with approximations of pi.

Here are some links on calculating pi:
http://mathworld.wolfram.com/PiApproximations.html
http://mathworld.wolfram.com/PiFormulas.html