Input:-
Output:-
digit
= int(input("Enter the Digit:"))
print("palindrome
Number:-")
def
reverse(num):
rev = 0;
while (num > 0):
rev = rev * 10 + num % 10;
num = num // 10;
return rev;
def
isPalindrome(num):
if (num == reverse(num)):
return True;
return False;
def
printPalindromes(d):
if (d <= 0):
return;
smallest = pow(10, d - 1);
largest = pow(10, d) - 1;
if (isPalindrome(i)):
print(i, end = " ");
printPalindromes(digit);
Output:-
No comments:
Post a Comment