Recent

Saturday, October 15, 2022

Python program to check whether a number is Prime or not






# Number to be checked for prime

n = 5

# Check if the number is greater than 1

if n > 1:

  for i in range(2, int(n/2)+1):

    if (n % i) == 0:

      print(n, "is not a prime number")

    break

  else:

    print(n, "is a prime number")

else:

  print(n, "is not a prime number")

  

#fb/codingjugaad

No comments:

Post a Comment