X324: sumMultiples

Given an integer num, return the sum of the multiples of num between 1 and 100. For example, if num is 20, the returned value should be the sum of 20, 40, 60, 80, and 100, which is 300. If num is not positive, return 0.

Examples:

sumMultiples(20) -> 300
sumMultiples(5) -> 1050

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.