Skip to content

Commit

Permalink
Create index.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Soumyaditya25 authored Oct 5, 2024
1 parent a1cd885 commit 9acbda4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
num = 11
#Negative numbers, 0 and 1 are not primes
if num > 1:

# Iterate from 2 to n // 2
for i in range(2, (num//2)+1):

# If num is divisible by any number between
#2 and n / 2, it is not prime
if (num % i) == 0:
print(num, "is not a prime number")
break
else:
print(num, "is a prime number")
else:
print(num, "is not a prime number")

0 comments on commit 9acbda4

Please sign in to comment.