Computer Science, asked by Harshrock7485, 10 months ago

Write A Prime Number Program In Python

Answers

Answered by pavithranatarajan855
1

Answer:

num = int(input())

if num > 1:

  # check for factors

  for i in range(2,num):

      if (num % i) == 0:

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

          print(i,"times",num//i,"is",num)

          break

  else:

      print(num,"is a prime number")

else:

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

Explanation:

Similar questions