Find if the given number is prime or not

example:
input = 5
output = prime

1 Like

the no. 5 is a prime no. , a prime no. is a positive integer greater than 1 that has no positive integer divisors other than 1 and itself…the no. 5 is only divisible by 1 and 5 itself

2 Likes

if num > 1:
for i in range(2, int(num/2)+1):
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”)