Created
September 1, 2022 15:53
-
-
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
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
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