Skip to content

Instantly share code, notes, and snippets.

@mathildathompson
Created April 3, 2014 22:00
Show Gist options
  • Save mathildathompson/9963766 to your computer and use it in GitHub Desktop.
Save mathildathompson/9963766 to your computer and use it in GitHub Desktop.

Sum of Multiples

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Write a program that, given a number, can find the sum of all the multiples of 3 or 5 up to and including that number.

Allow the program to be configured to find the sum of multiples of numbers other than 3 and 5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment