Created
October 6, 2021 18:20
-
-
Save galihboy/b1911a3a0e50c5be607f92964fe90461 to your computer and use it in GitHub Desktop.
deret bilangan prima
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 CekPrima(bilangan): | |
prima = True | |
for i in range(2, bilangan): | |
if (bilangan % i == 0): | |
prima = False | |
break | |
return prima | |
min = 2 | |
max = 20 | |
for i in range(min, max+1): | |
if CekPrima(i): | |
print(i, end=" ") | |
# output: 2 3 5 7 11 13 17 19 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment