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
How can any user find out all information about a specific user like his default shell, real-life name, default directory, when and how long he has been using the system?
How do I run a .sh file?
Rewrite the command to print the sentence and convert the variable to plural: echo “i like $variable”.
How do I run a powershell script?
What are the advantages of shell scripting?
What does $@ mean bash?
What is the conditional statement in shell scripting?
How do we create command aliases in a shell?
What are the various stages of a linux process it passes through?
How do I set bash as default shell mac?
Is shell scripting difficult?
What is shell terminal?
Determine the output of the following command: name=shubham && echo ‘my name is $name’.
write a shell script to generate a alert ? like when ur birthday came then generate a alert ur birthday is today like that ?
How do I run a script from command prompt?