write a shell script to identify the given string is
palindrome or not?
Answer Posted / siva
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 + $rev \* 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 ? | 24 Yes | 7 No |
Post New Answer View All Answers
What is wc in shell script?
What is bash shell command?
What does path stand for?
How can the contents of a file inside jar be read without extracting in a shell script?
What is the significance of the shebang line in shell scripting?
Explain about stdin, stdout and stderr?
Why is used in shell scripting?
How will you connect to a database server from linux?
What are script files?
Why is a script important?
How to get the 3rd element/column from each line from a file?
What are scripts in psychology?
What is the use of "$#" in shell scripting?
What does debug script mean?
Where are cowrie shells found?