Write a python script to check weather inputted number is prime or not. - Pratik Ghelani

Pratik Ghelani

Breaking

Sunday, May 10, 2020

Write a python script to check weather inputted number is prime or not.

Input:-

num = int(input("Enter the number:"))
if num > 1:
   for i in range(2, num//2):
       if (num % i) == 0:
           print(num, "is not a prime number")
           break
   else:
       print(num, "is a prime number")
else:

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

Output:-




No comments:

Post a Comment