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
Is powershell a language?
What is difference between bash and shell?
What exactly is a shell?
What is meant by $1 in shell script?
What language is bash?
How will you connect to a database server from linux?
What is a shell made of?
What is a program shell?
What are the advantages of using shell scripts?
What is shell geeksforgeeks?
Explain about gui scripting?
Explain about return code?
Is shell a part of kernel?
How do I open the shell prompt?
Explain about stdin, stdout and stderr?