Skip to content

Instantly share code, notes, and snippets.

@himerzi
Last active September 29, 2017 10:19
Show Gist options
  • Save himerzi/9669723 to your computer and use it in GitHub Desktop.
Save himerzi/9669723 to your computer and use it in GitHub Desktop.
Code Crackle Pop
(defn CracklePop
[]
(let [crackle-sequence (for [n (range 1 101)
:let [div3 #(= 0 (mod % 3))
div5 #(= 0 (mod % 5))]]
(cond
(and (div5 n) (div3 n)) "CracklePop"
(div3 n) "Crackle"
(div5 n) "Pop"
:else n))]
(apply println crackle-sequence)))
@ConsciousExplorer
Copy link

ConsciousExplorer commented Sep 29, 2017

#Written in python

for i in range(1, 101):
if i%3 == 0 and i%5 == 0:
print("CracklePop")
if i%3 == 0:
print("Crackle")
if i%5 == 0:
print("Pop")
else:
print(i)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment