Post Page Advertisement [Top]

python program

How to make a program in python to check the given number is prime or not ?

# prime no

while 1:
    x=int(input('Enter no : '))
    i=2
    temp=0
    while i <= x/2:
        if x%i==0:
            temp=1
        i=i+1
    if temp==1:
        print(x,'is not prime')
    else:
        print(x,'is prime')
    print('--------------------------------------------------')


Thank-you 

No comments:

Post a Comment

Bottom Ad [Post Page]