Last active
September 29, 2017 10:19
-
-
Save himerzi/9669723 to your computer and use it in GitHub Desktop.
Code Crackle Pop
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
(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))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#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)