Skip to content

Instantly share code, notes, and snippets.

@iKunalmathur
Created September 1, 2022 15:53
Show Gist options
  • Save iKunalmathur/f7a7d20eff626b14450c275e59f5f15e to your computer and use it in GitHub Desktop.
Save iKunalmathur/f7a7d20eff626b14450c275e59f5f15e to your computer and use it in GitHub Desktop.
Using for loop please print all the prime numbers between 1-200 using FOR LOOP AND RANGE function
for Number in range (1, 200):
count = 0
for i in range(2, (Number//2 + 1)):
if(Number % i == 0):
count = count + 1
break
if (count == 0 and Number != 1):
print(" %d" %Number, end = ' ')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment