Skip to content

Instantly share code, notes, and snippets.

@heavy-metal-blues-code
Last active December 5, 2022 10:07
Show Gist options
  • Save heavy-metal-blues-code/563fea0d872b1cdf64876699eb696ab1 to your computer and use it in GitHub Desktop.
Save heavy-metal-blues-code/563fea0d872b1cdf64876699eb696ab1 to your computer and use it in GitHub Desktop.
Applying to RC
#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