Easiest Way Finding PI
Once again we have decided to play with the mysterious ∏. However, this time rather than just merely talk about this mysterious figure we will be implementing a simple algorithm to find an approximate value of the same. The said method as follows:
- Inscribe a circle in a square
- Randomly generate points in the square
- Determine the number of points in the square that are also in the circle
- Let n be the number of points in the circle divided by the number of points in the square
- PI ~ 4 n
- Note that the more points generated, the better the approximation
A simple C program for the same may be downloaded from here:http://equinox-northeast.110mb.com/xus/pi.c
kindly send your feedbacks and bug reports on xitij1983@rediffmail.com