Wikipedia details a lot of ways to get numerical approximations of pi here. They also give some sample pseudo-code
Edit : If you're interested in this kind of mathematical problems without having any related real-world problem to solve (which is definitely a good attitude to have, IMHO), you could visit the Euler Project page
Brann
2009-10-06 07:58:22