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
How do I run a script from command prompt?
What is difference between shell and bash scripting?
How do I open a jshell in cmd?
Explain about login shell?
What does $1 mean in bash?
What are the two files of crontab command?
Explain about shebang?
I have to write Shells (Linux + Unix)for publishing packages and reports. Is it possible ? What are the differents executable programs ineed to call ?
Is shell scripting useful?
Can we run shell script in windows?
How do you create a shortcut in linux?
What is a beat in a script?
What are the types of script?
What is echo $shell?
What language is shell scripting?