Dec 102017
Five ways to calculate PI. C source code.
File PI-5WAYS.ZIP from The Programmer’s Corner in
Category C Source Code
Five ways to calculate PI. C source code.
File Name File Size Zip Size Zip Type
CANNON.C 3389 1106 deflated
PI1.C 1407 444 deflated
PI2.C 1383 444 deflated
PI3.C 1314 410 deflated
PINDROP.C 3870 1065 deflated
READ.ME 989 593 deflated

Download File PI-5WAYS.ZIP Here

Contents of the READ.ME file


The five included files illustrate different methods to appoximate . PI1.C,
PI2.C, and PI3.C use series expansions. CANNON.C simulates firing a cannon
at a circular pond enclosed (inscribed) in a square of land. PINDROP.C is
the notorious pin drop simulation, whereby you drop a pin on a wood plank
floor, keep track of how many times the pin falls on a crack, and take the
ratio of "hits" to total drops.

The source code should compile with no problems on just about any version of
C, with a couple of trivial changes. You may have to " #include " at
the beginning of the files. A couple of the files use the function
"clrscrn()", which clears the screen. You may need to substitute an
equivalent function call, or just plain delete that line.

These files are placed into the Public Domain for educational purposes.


Mendel Cooper
3138 Foster Ave.
Baltimore, MD 21224


 December 10, 2017  Add comments

Leave a Reply