Created
May 14, 2024 03:51
-
-
Save DrunkenAlcoholic/30c0d79e6918708469cb57c5c869f04c to your computer and use it in GitHub Desktop.
Sum Of Multiples [Exercism - Nim]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc sum*(limit: int, factors: openArray[int]): int = | |
for i in 0..<limit: | |
for num in factors: | |
if num != 0 and i mod num == 0: | |
result += i | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment