Structure Query Language, C programming, Java, Servlet, Jsp, Unix

Tuesday, 13 March 2012

Write a script to check whether a given number is palindrome or not.


clear
echo "              NUMBER PALINDROME OF NOT"
echo "              ========================"
echo "ENTER NUMBER : "
read no
temp=$no
revno=0
while [ $no -ne 0 ]
do
a=`expr $no % 10`
no=`expr $no / 10`
revno=`expr $revno \* 10 + $a`
done
if [ $temp -eq $revno ];then
echo "Number is palindrome"
else
echo "Number is not palindrome"
fi

1 comment:

  1. This is the best blog design and article. Very nice job. Thank you very much..


    Java and J2EE Training in Chennai - AmitySoft

    ReplyDelete