Last active
December 5, 2022 10:07
-
-
Save heavy-metal-blues-code/563fea0d872b1cdf64876699eb696ab1 to your computer and use it in GitHub Desktop.
Applying to RC
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
#Write a program that prints out the numbers 1 to 100 (inclusive). | |
#If the number is divisible by 3, print Crackle instead of the number. | |
#If it's divisible by 5, print Pop. If it's divisible by both 3 and 5, print CracklePop. | |
#You can use any language. | |
def print_number(n): | |
if n > 0: | |
print_number(n - 1) | |
if n % 3 == 0: | |
if n % 3 == 0 and n % 5 == 0: | |
print "CracklePop" | |
print "Crackle" | |
elif n % 5 == 0: | |
print "Pop" | |
else: | |
print n | |
print_number(100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment