Last active
August 29, 2015 13:56
-
-
Save arakban/9119672 to your computer and use it in GitHub Desktop.
This piece of code the multiples of the numbers a and b, from 0 to the number set as the limit by the user.
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 multiples(limit,a,b): | |
n = 0 | |
while n<limit: | |
if n%a == 0 and n%b == 0: | |
print str(n) + ' is a multiple of ' + str(a) + ' and ' + str(b) | |
n = n + 1 | |
elif n % a == 0: | |
print str(n) + ' is a multiple of ' + str(a) | |
n = n + 1 | |
elif n % b == 0: | |
print str(n) + ' is a multiple of ' + str(b) | |
n = n + 1 | |
else: | |
n = n + 1 | |
return 'Finding the multiples is over guys!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment