Program to find whether the given number is prime or not
#Program to find whether the given number is prime or not
n=int(input("Enter a number "))
for i in range(2,n):
if (n%i)==0:#Remainder of a composite number with its factor is 0
print(n," is not a prime number")
break #Loop is discontinued if any factor of number is found
else:
print(n," is a prime number")
Comments
Post a Comment