What is prime number:-
A number is called prime number if it divisible by only 1 and itself .
example:- 3 is divisible by 1 and 3 only.So 3 is a prime number.
2,3,5,7...... all are also a prime number.
code:-
num=int(input("Enter a number"))
for i in range(2,num//2+1):
flag=0
if num%i==0:
flag=1
break
if flag==1:
print("Not prime")
else:
print("Prime number")
Output:-
Enter a number3
Prime number
0 Comments