Check Prime Number in Python.
number = int(input("Enter a number :: "))
if number > 1:
for i in range(2,number):
if (number % i) == 0:
print(number,"is not a prime number")
print(i,"times",number//i,"is",number)
break
else:
print(number,"is a prime number")
else:
print(number,"is not a prime number")
OUTPUT
Enter a number :: 631
631 is a prime number
No comments:
Post a Comment
Please do not any spam link in Comment Box