SOURCE CODE:
echo “Enter the string:“
read str
l =`expr length $str`
a=l
while [ $a –lt -$l ]
do
s1=`echo $str | cut –c $a`
s2=`echo $str | cut –c $l`
if [ $s1 != $s2 ]
then
break;
else
a =`expr $a + 1`
l =`expr $l – 1`
fi
done
if [ $a = $l ]
then
echo “Given string is Palindrom”
fi
OUTPUT:
Enter the string:
AEHLE
Given string is not Palindrom
No comments :
Post a Comment