Monday, March 14, 2011

Happy pi day!

{

class Program
{

static double PI(int i, int limit)
{
return (i > limit)? 1 : (1 + i / (2.0 * i + 1) * PI(i + 1, limit));
}

static void Main(string[] args)
{
double pi = 2 * PI(1, 2011);
Console.WriteLine(pi);
Console.WriteLine("Happy pi day!");
Console.ReadLine();
}
}


}