Skip to content

Instantly share code, notes, and snippets.

@galihboy
Created October 6, 2021 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save galihboy/b1911a3a0e50c5be607f92964fe90461 to your computer and use it in GitHub Desktop.
Save galihboy/b1911a3a0e50c5be607f92964fe90461 to your computer and use it in GitHub Desktop.
deret bilangan prima
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