smehta2205 / Practice-Python

This repository will be a collection of solutions for programs given in various Python practice websites like practicepython.org, hackerrank etc.
4 stars 52 forks source link

prime pyhton #79

Open Apoorv1 opened 5 years ago

Apoorv1 commented 5 years ago

num = int(input("Enter a number: "))

if num > 1:
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")