Program to check whether a given number is prime or not in Python

 n=5

flag=False

if (n>1):

    for i in range(2,n):

        if(n%i)==0:

            flag=True

            break

if flag:

    print(n,"is not prime")

else:

    print(n,"is prime")


Comments

Popular posts from this blog

Data Science Matplotlib Library Data Visualization, ASSIGNMENT - 6, GO_STP_8113