Write a Java definition of function sumOdds(n) which produces the sum of the odd integers that are less than or equal to n. Assume that n is an odd positive integer. For example, sumOdds(3) = 1 + 3 = 4, and sumOdds(7) = 1 + 3 + 5 + 7 = 16. Use recursion.

Assume that the argument has type int and the result also has type int.

(Hint. For n = 1, just say what the answer is. For n > 1, look for a smaller problem of the same kind that will help you, and use the same function to solve that smaller problem.)

 

    [Language: Java  Kind: function definition]