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

 

productOfFourths


Write a function that returns the product of the first n fourths. So for n=1 it would return 1/4, for n=2 it would return 1/4 * 2/4, for n=3 it would return 1/4 * 2/4 * 3/4, and so on. Note the return type for this function is double. Also note that you should multiply the numbers in order starting from 1/4. Reversing the order will produce a slightly different result.


productOfFourths(0) → 0.0
productOfFourths(1) → 0.25
productOfFourths(2) → 0.125

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

public double productOfFourths(int n){ }

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

Post-solution available

Copyright Nick Parlante 2017 - privacy