Skip to content

Commit 1159a9f

Browse files
authored
Program to check number is prime or not
1 parent 7e847b2 commit 1159a9f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Is_Prime.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
def IsPrime(value):
2+
cnt=0
3+
for i in range(2,value):
4+
if value%i==0:
5+
cnt=cnt+1
6+
return cnt>0
7+
8+
9+
def main():
10+
print("\nEnter Number:")
11+
no=int(input())
12+
13+
ret=IsPrime(no)
14+
15+
if ret==True:
16+
print("{} is not prime number\n\n".format(no))
17+
18+
else:
19+
print("{} is prime number\n\n".format(no))
20+
21+
if __name__=="__main__":
22+
main()
23+

0 commit comments

Comments
 (0)