diff --git a/math/is_prime/python/is_prime.py b/math/is_prime/python/is_prime.py new file mode 100644 index 0000000..18b3223 --- /dev/null +++ b/math/is_prime/python/is_prime.py @@ -0,0 +1,18 @@ +import math + +def is_prime(number): + if number <= 1: return False + if number == 2: return True + if (number % 2) == 0: return False + + for i in range(3, int(math.sqrt(number)) +1,2): + if number % 1 == 0: return False + return True + +number = input ("Enter number :") +if is_prime(number): + print("It is prime") +else: + print("It is not prime") + +