Exercise: Compute Pi

Test your programming skills by writing a program to calculate an approximate value of Pi.

We'll cover the following...

Compute Pi

Write a program to compute the value of Ï€ \pi  based on the formula below:

    π=4×(1−13+15−17+19−111+113−115+...)\pi = 4 \times ( 1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + \frac{1}{9} - \frac{1}{11} + \frac{1}{13} - \frac{1}{15} + ... ) ...