Consider a class MathUtils which has method that perform various mathematical functions using recursion. public class MathUtils
Fantastic news! We've Found the answer you've been seeking!
Question:
Consider a class MathUtils which has method that perform various mathematical functions using recursion.
public class MathUtils
{
public static int factorial ( int n)
{
//to be implemented }
public static int power ( int base, int exp)
{
// to be implemented}
public static void triple (int[] a)
{
//to be implemented}
}
The factorial method returns the factorial of the number given. Implement factorial using recursion.
The power method raises base to the power exp. Implement power using recursion.
The triple method triples every element in the given array. Implement triple using recursion, adding a helper method if necessary.
Related Book For
Probability and Random Processes With Applications to Signal Processing and Communications
ISBN: 978-0123869814
2nd edition
Authors: Scott Miller, Donald Childers
Posted Date: