clear
echo "Palindrome Number Checking"
echo "------------------------------"
echo
echo "Enter the Number"
read n
s=0
n1=$n
while[$n -gt 0]
do
r='expr $n%10'
s='expr $s \* 10 + $r'
n='expr $n/10'
done
echo
echo "The Reverse Number is:"$s
if[$s -eq $n1]
then
echo
echo "The Given Number is Palindrome"
else
echo
echo "The Given Number is not Palindrome"
fi
-----------
OUTPUT:
-----------
Palindrome Number Checking
-------------------------------
Enter the Number
121
The Reverse Number is:121
The Given number is palindrome
Palindrome Number Checking
------------------------------
Enter the Number
122
The Reverse Number is:221
The Given Number is not palindrome
echo "Palindrome Number Checking"
echo "------------------------------"
echo
echo "Enter the Number"
read n
s=0
n1=$n
while[$n -gt 0]
do
r='expr $n%10'
s='expr $s \* 10 + $r'
n='expr $n/10'
done
echo
echo "The Reverse Number is:"$s
if[$s -eq $n1]
then
echo
echo "The Given Number is Palindrome"
else
echo
echo "The Given Number is not Palindrome"
fi
-----------
OUTPUT:
-----------
Palindrome Number Checking
-------------------------------
Enter the Number
121
The Reverse Number is:121
The Given number is palindrome
Palindrome Number Checking
------------------------------
Enter the Number
122
The Reverse Number is:221
The Given Number is not palindrome
0 comments:
Post a Comment