id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

approxPI


Pi can be approximated using the following formula Pi = 4 ( 1 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 + ... Complete the method so that it calculates pi given the amount of terms


approxPI(1) → 4.0
approxPI(2) → 2.666666666666667
approxPI(3) → 3.466666666666667

...Save, Compile, Run (ctrl-enter)

public double approxPI(int numTerms){ }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 200

Copyright Nick Parlante 2017 - privacy