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
3 comments:
kewl post che bhai..
really good1
-jiga
Awesome! I'll have to check this one out! Mast chhe yaar! Maja aavi, fari lakho kaik to janavjo jarur.
~ Neel.
great che tamari jem j......
manan
Post a Comment