Last active
January 8, 2019 01:05
-
-
Save alefcarlos/b329f28d17652e9b1d32e2aa9b2b0b1a 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
/// <summary> | |
/// Validadtes if a value is multiple of other number | |
/// </summary> | |
/// <param name="y">The desired multiple.</param> | |
/// <param name="x">Value to check.</param> | |
/// <returns>Returns true if value is multiple of multiple</returns> | |
public static bool IsMultipleOf(int y, int x) | |
{ | |
//Check possible DivisionByZero | |
if (y == 0) | |
throw new ArgumentException("O múltiplo deve ser maior do que 0.", nameof(y)); | |
//A number is multiple if the remainder value is 0. | |
return (x % y) == 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment