We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents a1cd885 + 9acbda4 commit a6a16ffCopy full SHA for a6a16ff
index.py
@@ -0,0 +1,16 @@
1
+num = 11
2
+#Negative numbers, 0 and 1 are not primes
3
+if num > 1:
4
+
5
+ # Iterate from 2 to n // 2
6
+ for i in range(2, (num//2)+1):
7
8
+ # If num is divisible by any number between
9
+ #2 and n / 2, it is not prime
10
+ if (num % i) == 0:
11
+ print(num, "is not a prime number")
12
+ break
13
+ else:
14
+ print(num, "is a prime number")
15
+else:
16
0 commit comments