Answers for "print prime numbers from 1 to 10 in python using while loop"

-1

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
Posted by: Guest on April-23-2021

Code answers related to "print prime numbers from 1 to 10 in python using while loop"

Python Answers by Framework

Browse Popular Code Answers by Language