Write a shell script to check whether a given number is palindrome or not
Solution:
Execution:
Solution:
echo Enter the number
read num
d=`expr $num`
c=0
while [ $d -gt 0 ]
do
b=`expr $d % 10`
d=`expr $d / 10`
c=`expr $c \* 10 + $b`
done
if test $num -eq $c
then
echo The Given number is Palindrome
else
echo The number is not a Palindrome
fi
No comments:
Post a Comment