Knowee
Questions
Features
Study Tools

Problem StatementSusi loves playing with numbers and exploring their unique properties. One day, she learned about palindromic numbers and decided to write a program to check if a given number is a palindrome or not. Can you help her accomplish this task using a while loop?Note: palindrome is a number that is the same when reversed. For example, 121, 1331, and 45654 are palindromic numbers.Input format :The input consists of a single integer, n, where n is the number that Susi wants to check for palindromic properties.Output format :The output displays one of the following messages:"Palindrome" if n is a palindrome."Not a Palindrome" if n is not a palindrome.Refer to the sample output for the formatting specifications.Code constraints :In this scenario, the test cases fall under the following constraints:11 ≤ n ≤ 106Sample test cases :Input 1 :2552Output 1 :PalindromeInput 2 :1234Output 2 :Not a PalindromeInput 3 :11Output 3 :PalindromeInput 4 :1000000Output 4 :Not a Palindrome

Question

Problem StatementSusi loves playing with numbers and exploring their unique properties. One day, she learned about palindromic numbers and decided to write a program to check if a given number is a palindrome or not. Can you help her accomplish this task using a while loop?Note: palindrome is a number that is the same when reversed. For example, 121, 1331, and 45654 are palindromic numbers.Input format :The input consists of a single integer, n, where n is the number that Susi wants to check for palindromic properties.Output format :The output displays one of the following messages:"Palindrome" if n is a palindrome."Not a Palindrome" if n is not a palindrome.Refer to the sample output for the formatting specifications.Code constraints :In this scenario, the test cases fall under the following constraints:11 ≤ n ≤ 106Sample test cases :Input 1 :2552Output 1 :PalindromeInput 2 :1234Output 2 :Not a PalindromeInput 3 :11Output 3 :PalindromeInput 4 :1000000Output 4 :Not a Palindrome

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

Here is a Python solution for the problem:

def check_palindrome(n):
    temp = n
    rev = 0
    while(n > 0):
        dig = n % 10
        rev = rev * 10 + dig
        n = n // 10
    if(temp == rev):
        return "Palindrome"
    else:
        return "Not a

Similar Questions

Susi loves playing with numbers and exploring their unique properties. One day, she learned about palindromic numbers and decided to write a program to check if a given number is a palindrome or not. Can you help her accomplish this task using a while loop?

Check Palindrome NumberWrite a program to check if the given number is a palindrome number.A palindrome number is a number that is the same after reverse. For example, 545, is the palindrome numbers

Write a C++ program to check if a given number is a palindrome. A palindrome is a number that remains the same when its digits are reversed.

Write a programme to check whether given input is palindrome or notConstraintsABC != PalindromeMAM == Palindrome123 != Palindrome151 == Palindrome

Given an integer x, return true if x is a palindrome, and false otherwise. Example 1:Input: x = 121Output: trueExplanation: 121 reads as 121 from left to right and from right to left.Example 2:Input: x = -121Output: falseExplanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.Example 3:Input: x = 10Output: falseExplanation: Reads 01 from right to left. Therefore it is not a palindrome.

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.