Skip to content

Commit 50c035c

Browse files
author
Sagar Paul
committed
+++
1 parent f31b849 commit 50c035c

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#Palindromic Prime Numbers
2+
n = input("Write a number: ")
3+
4+
rev = n[::-1]
5+
if int(n)>1:
6+
if n == rev:
7+
for i in range(2,int(n)):
8+
if int(n)%i ==0:
9+
print(f"The number {n} is Palindrom but not Prime!")
10+
break
11+
else:
12+
print(f"The Number {n} is both Palindrom and Prime Number.")
13+
else:
14+
for i in range(2,int(n)):
15+
if (int(n)%i) ==0:
16+
print(f"The Number {n} is Neither Prime Nor Palindrom!")
17+
break
18+
else:
19+
print(f"The Number {n} is only Prime but not Palindrom!")
20+
elif int(n) == 1:
21+
print("1 is only Palindrom but not prime number!")
22+
23+
24+
25+
26+
27+
# Note: Negetive Numbers are not Palindromic

0 commit comments

Comments
 (0)