Question: in Java in java, Write a recursive method called sum Threes that takes as input an integer and returns the sum of all positive integers
Write a recursive method called sum Threes that takes as input an integer and returns the sum of all positive integers that are multiples of three, that are less than or equal to the input value, and are greater than 0. The method should be public and static. For example, System.out.println(sumn Threes(10)): would print 18 because 9 + 6 + 3 = 18. Your method should be able to function with any value. e.g. sumThrees(-5) should not infinitely recur. You will not receive credit for an iterative solution. Write a recursive method called sum Threes that takes as input an integer and returns the sum of all positive integers that are multiples of three that are less than or equal to the input value, and are greater than 0. The method should be public and static. For example, System.out.println(sumThrees(10); would print 18 because 9 + 6 + 3 = 18. Your method should be able to function with any value. e.g. sumThrees(-5% should not infinitely recur. You will not receive credit for an iterative solution
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
