Write a shell script to check the entered no is palindrome or not.

s=0
rev=0
echo "Enter any no" 
read no
temp=$no
while [ $no -ne 0 ]
do
	s=` expr $no % 10`
	rev=` expr $rev \* 10 + $s `
	no=` expr $no / 10`
done

if [ $temp -eq $rev ]
then
	echo "Given no is palindrome"
else
	echo "Given no is not palindrome"
fi

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *