If you want python program to check palindrome number then you are at right place. As python is the future of the technology, we all want to become a master in this programming language. Let’s start with the basic.
Here we are going to tell how you can write a
simple program which checks whether a given number is a palindrome or not. It
is quite simple using reverse function of python but here, we will have a given
number and our goal is to find out the palindrome number by doing some
calculation (without using reverse function). You will gain the concept of
input / output statement and practice the control statements.
Example:
Input: Enter a number: 1331 Output: Number is palindrome |
Input: Enter a number: 78900987 Output: Number is palindrome |
Task:
For given Pseudo-Code Magnets arrange it in correct order and complete
Pseudo-code Magnets:
Number=Number%10
Remainder=Number/10
while (Number! =0) do
if(Temp==Reverse) then
Temp=Number
else
Reverse=0
Number=Number/10
display "Palindrome"
while(Number==0) do
Reverse=Reverse*10+Remainder
Reverse=Remainder*10+Reverse
input Number
end-while
Remainder=Number%10
end-if
display "Not a Palindrome"
Program to check palindrome number:
Output:
Note: If you have any doubt regarding the program, you can mention them in the
comment section.
Comments
Post a Comment