Last active
January 8, 2019 04:48
-
-
Save alefcarlos/35832356cbe4afe3f81adb3dfba49a56 to your computer and use it in GitHub Desktop.
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
public static bool IsMultipleOf(int y, int x) | |
{ | |
//Chek if value is negative | |
if (x < 0 || y < 0) | |
throw new ArgumentException("Essa operação só é possível com números naturais."); | |
//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