Created
January 8, 2019 01:38
-
-
Save alefcarlos/ebd3bf80940425002dca335111151e4a to your computer and use it in GitHub Desktop.
This file contains 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
using System.Linq; | |
.... | |
public static int SumOfMultiples(int max, params int[] possibleMultiples) | |
{ | |
int sum = 0; | |
//Validate if the number is MultipleOf, then sum it | |
for (int value = 1; value < max; value++) | |
sum += possibleMultiples.Any(y => Helpers.IsMultipleOf(y, value)) ? value : 0; | |
return sum; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment