0

Write a program to print and check that no. Is palindrome or not.

(In python language)

24th Jun 2019, 10:02 AM
No Limit
No Limit - avatar
5 odpowiedzi
+ 1
No Limit you shouldn't just be asking people to write programs for you, it's more like asking people to do your homework for you (even if that's not what it is) You should first of attempt the challenge, and then ask questions wherever you get stuck. You'll learn better that way
24th Jun 2019, 10:51 AM
Dlite
Dlite - avatar
+ 4
You can do it like Dejan Francuz, or like this num = input() if num == num[::-1]: print("Palindrome")
24th Jun 2019, 12:52 PM
Trigger
Trigger - avatar
+ 2
Thomas Williams yeah 🤣
24th Jun 2019, 1:15 PM
Dejan Francuz🥇
Dejan Francuz🥇 - avatar
+ 1
Hi there, So to check if number is palindrome or not you have to check the entered number in reversed way, code for that is: number = int(input()) reverse = 0 while(number >0): reminder = number % 10 reverse = (reverse * 10) + reminder number = number // 10 Now you can just check with if statement if entered number is equal to reversed.
24th Jun 2019, 10:25 AM
Dejan Francuz🥇
Dejan Francuz🥇 - avatar
+ 1
n=int(input("enter")) temp=n m=0 while (n! =0) : k=n%10 m=m*10+k n=n//10 print(m) if m==temp: print("no.is palindrome ") else: print (" no. is not palindrome ")
24th Jun 2019, 3:20 PM
Muskan Singh
Muskan Singh - avatar