Shell Programs
Shell Programs
14. Write a shell script to check whether a given number is palindrome or not
# check whether a given number is palindrome or not
read -p "Enter a number:" num
n=$num
rev=0
while [ $n -gt 0 ]
do
d=$(($n % 10))
rev=$((($rev *10) + d))
n=$(($n / 10))
done
if [ $rev -eq $num ]
then
echo "$num is Palindrome"
else
echo "$num is not palindrome"
fi