Created
November 6, 2014 16:30
-
-
Save federicobucchi/d575a9ca13accebfcd9a to your computer and use it in GitHub Desktop.
Custom modulus function
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
def custom_mod(input) | |
arr = input.split(',') | |
number = arr[0].to_i | |
divisory = arr[1].to_i | |
n_times = number / divisory | |
res_molt = divisory * n_times | |
return number - res_molt | |
end | |
custom_mod('20, 3') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment