Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

prime number in python

a=int(input("Enter number: "))
k=0
for i in range(2,a//2+1):
    if(a%i==0):
        k=k+1
if(k<=0):
    print("Number is prime")
else:
    print("Number isn't prime")
Source by www.sanfoundry.com #
 
PREVIOUS NEXT
Tagged: #prime #number #python
ADD COMMENT
Topic
Name
8+5 =