Untitled

mail@pastecode.io avatar
unknown
plain_text
13 days ago
317 B
12
Indexable
Never
5. Check if a given number is a Prime Number or not.

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

flag=False
if num==1:
 print(num,"is not a prime Number")
elif num>1:
 for i in range(2,num):
 if(num%i)==0:
 flag=True
 break
 
if flag:
 print(num,"is not a prime number")
 else:
 print(num,"is a prime number")
Leave a Comment