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 are the various stages of a linux process it passes through?
What does path stand for?
What is the command to find out users on the system?
Explain about login shell?
Explain how you Automate your application using Shell scripting.
Please give me example of " at command , contrab command " how to use
write a shell script to check the failed jobs?
How important is shell scripting?
What is the best shell scripting language?
What is shift command in shell script?
How do you debug a script?
What is echo in shell?
How to print the first array element?
What is the syntax of "nested if statement" in shell scripting?
Why should we use shell scripts?