- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPrimeNumber.py
More file actions
Latest commit
19 lines (16 loc) · 563 Bytes
/
Copy pathPrimeNumber.py
File metadata and controls
19 lines (16 loc) · 563 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#Vijesh.V @freakoutgames
#program for finding out if a number is prime number or not
#prime number is a number divisible by 1 or by itself
defprime_number(num):
if (num<=1):
returnFalse#for numbers that is less or equal to 1
forxinrange(2, num):
if (num%x==0):
returnFalse
returnTrue
#calling the function to check
number=input("Enter any number to check: ")
if(prime_number(int (number))):
print("The number %d is prime"%int (number))
else:
print("The number %d is not prime"%int (number))