write a shell script to identify the given string is
palindrome or not?
Answer Posted / hemanth kadham
echo "PALINDROME NUMBER"
echo "ENTER THE NUMBER :"
read n
n1=$n
rev=0
while [ $n1 -ne 0 ]
do
rem=`expr $n1 % 10`
n1=`expr $n1 / 10`
rev=`expr $rem + $n1 \* 10`
done
if [ $n -eq $rev ]
then
echo $n is a Palindrome Number
else
echo $n is not a Palindrome Number
fi
PALINDROME NUMBER
ENTER THE NUMBER :
121
121 is a Palindrome Number
$sh palno.sh
PALINDROME NUMBER
ENTER THE NUMBER :
123
123 is not a Palindrome Number
Is This Answer Correct ? | 5 Yes | 4 No |
Post New Answer View All Answers
What is the significance of $#?
What are the advantages of shell script?
How to print pid of the current shell?
Is cmd a shell?
Which shell is the best?
What is shift command in shell script?
Explain about the slow execution speed of shells?
Explain about sourcing commands?
Explain about login shell?
What is the first line in a shell script?
What are the different variables present in linux shell?
Explain about stdin, stdout and stderr?
What is path in shell script?
What is a shell environment?
shell script for reverse the string