Skip to content

Latest commit

 

History

History
23 lines (16 loc) · 593 Bytes

File metadata and controls

23 lines (16 loc) · 593 Bytes

Multiples

You need to calculate the sum of all the multiples of 3 or 5 below a given number.

Task:

Given an integer number, output the sum of all the multiples of 3 and 5 below that number. If a number is a multiple of both, 3 and 5, it should appear in the sum only once.

Input Format:

An integer.

Output Format:

An integer, representing the sum of all the multiples of 3 and 5 below the given input.

Sample Input:

10

Sample Output:

23

Explanation:

The numbers below 10 that are multiples of 3 or 5 are 3, 5, 6 and 9. The sum of these numbers is 3+5+6+9=23