Added Prime Number checker alorithm

pull/802/head
WORLDSAVER 2022-08-15 21:36:27 +05:30
parent 6f19b452ea
commit da4a105bb7
2 changed files with 20 additions and 0 deletions

View File

@ -83,3 +83,7 @@
## Queues
- [First in First out Queue](queues/fifo-queue.py)
##Number Theory
- [Prime Number Checker][number_theory/prime_number.py]

View File

@ -0,0 +1,16 @@
#TO CHECK WHETHER A NUMBER IS PRIME OR NOT
N = int(input())
PRIME = True
for i in range(2, int(N**0.5+1)):
if N%i==0:
PRIME = False
break
if PRIME:
print(f"{N} is prime")
else:
print(f"{N} is not prime")