print prime numbers from 1 to 10 in python using while loop code example
Example: print prime numbers from 1 to 10 in python using while loop
# Python Program to print Prime Numbers from 1 to 100
Number = 1
while(Number <= 100):
count = 0
i = 2
while(i <= Number//2):
if(Number % i == 0):
count = count + 1
break
i = i + 1
if (count == 0 and Number != 1):
print(" %d" %Number, end = ' ')
Number = Number + 1