-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathques5.py
More file actions
30 lines (26 loc) · 715 Bytes
/
ques5.py
File metadata and controls
30 lines (26 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
'''
Program: Write a program to check whether the inputted number is palindrome or not.
Author: Bikramadittya Bagchi
Date: 04-03-2021
'''
def checkPalin(num):
temp = num; sum = 0
while temp > 0:
rem = temp % 10
sum = sum * 10 + rem
temp = temp // 10
if sum == num:
return True
else:
return False
def main():
inp = int(input("Enter any number to check palindrome: "))
if inp > 0:
if checkPalin(inp):
print(f"Entered number {inp} is a Palindrome number")
else:
print(f"Entered number {inp} is not a Palindrome number")
else:
print("Invalid input given!")
if __name__ == "__main__":
main()