maynul67

Check if number is prime

Jul 13th, 2021
816
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. a = int(input("enter number to check:      "))
  2.  
  3. def is_prime(n):
  4.     for i in range(2,n):
  5.         if n%i == 0:
  6.             return False
  7.     return True
  8. result = is_prime(a)
  9. if result == False:
  10.     print("not prime")
  11. else:
  12.     print("prime")
RAW Paste Data