Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

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?

1159


How do I run a .sh file?

1073


Rewrite the command to print the sentence and convert the variable to plural: echo “i like $variable”.

1142


How do I run a powershell script?

1189


What are the advantages of shell scripting?

1092


What does $@ mean bash?

1245


What is the conditional statement in shell scripting?

1284


How do we create command aliases in a shell?

1035


What are the various stages of a linux process it passes through?

1248


How do I set bash as default shell mac?

1051


Is shell scripting difficult?

1001


What is shell terminal?

998


Determine the output of the following command: name=shubham && echo ‘my name is $name’.

1036


write a shell script to generate a alert ? like when ur birthday came then generate a alert ur birthday is today like that ?

4184


How do I run a script from command prompt?

1137