Part One
Write a recursive function which computes the factorial of a number, but have it return a double, not a long or int.
Part Two
Use the method in part one to make a calculation of Euler's number 'e'. The formula for this is e = 1 + 1/1! + 1/2! + 1/3! + .... You may do this calculation in a loop or as a recursive method. Make sure that your estimate is within 0.001 of the actual value of e.
Part Three
Right a recursive function which computes the greatest common denominator of two integers. The formula for GCD is
gcd( m, n) = { n if n evenly divides m, or gcd( n, remainder of m/n) otherwise }What to turn in
Print out and turn in the code and any test runs of your results. Make sure that all of your methods are properly commented, and that your test runs properly test all kinds of inputs to your functions.
Turn these in at the beginning of class on 25 April, 2007.