Subscribe to Get Free Material Updates!
Visit my new blog WebData Scraping - Web Scraping Service provider company in India.

Write a script to check whether a given string 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

Output:

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes