CHRIST MCA 2009-2012
Would you like to react to this message? Create an account in a few clicks or log in to continue.

38. WASS to check whether the word given is a palindrome or not.

Go down

38. WASS to check whether the word given is a palindrome or  not. Empty 38. WASS to check whether the word given is a palindrome or not.

Post  sowmya Wed Jul 21, 2010 9:54 pm

clear
echo "Enter a string"
read str
l=`echo $str | wc -c`
l=`expr $l - 1`
i=1
mid=`expr $l / 2`
while test $l -le $mid
do
a=`expr $str | cut -c $i`
b=`expr $str | cut -c $l`
if test $a != $b
then
echo "It is not a palindrome"
exit
fi
i=`expr $i + 1`
l=`expr $l - 1`
done
echo "It is a palindrome"








Like a Star @ heaven -----------> this program has to work fine.. check out people Laughing

sowmya

Posts : 5
Join date : 2010-07-21

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum