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Â
    
Note: We cannot sum infinitely many terms. So, we'll compute an approximate value by limiting the number of terms.
Compare your result with Ruby's built-in constant Math::PI
.
Get hands-on with 1400+ tech skills courses.