Skip to content

Commit

Permalink
Detect Prime Number
Browse files Browse the repository at this point in the history
  • Loading branch information
XFarooqi committed Oct 2, 2022
1 parent 57838d5 commit 8b40b6b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions python/prime.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
def isPrime(n):

if n > 1:
for i in range(2, n):
if n % i == 0:
# return False
print(f"number {num} is not a prime")
break
else:
print(f"number {n} is a prime")

num = int(9)
isPrime(num)


0 comments on commit 8b40b6b

Please sign in to comment.