about | help | code help+videos | done | prefs |
Write a method that recursively computes the nth approximation of the Golden Ratio using the recursive computational method shown here: As a pre-condition, the parameter n will be greater than or equal to zero and will not be so large as to cause a stack-overflow for a well-made program. For n=0 (the 0th approximation) simply use 1. For n>0 the approximation is equal to 1+(1/G(n-1)) where G(n-1) is the (n-1)th approximation of the Golden Ratio. Look at the test data for examples. dec18_2015_HL_findGolden(29) → 1.6180339887505406 dec18_2015_HL_findGolden(7) → 1.619047619047619 dec18_2015_HL_findGolden(0) → 1.0 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 230
Copyright Nick Parlante 2017 - privacy