Title: Check whether the given number is
Prime number or not
If any number contains only two factors that number is called prime
number.
Program:
n=int(input("Enter n value\n"))
c=0
for i in range(1,n+1):
if(n%i==0):
c=c+1
if(c==2):
print(n," is a prime
number")
else:
print(n," is not a prime
number")
Output:
Enter n value
5
5 is a
prime number
Comments
Post a Comment