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

What command needs to be used to take the backup?

938


What does it mean by #!/Bin/sh or #!/Bin/bash at the beginning of every script?

1001


Is powershell a bash?

1018


Why do we write bin bash in shell scripts?

959


What is the difference between break and continue commands?

1037


In my bash shell I want my prompt to be of format '$"present working directory":"hostname"> and load a file containing a list of user-defined functions as soon as I log in, how will you automate this?

1070


What is web script?

1033


What is the use of break command?

1039


How do I edit a .sh file?

1074


How to print pid of the current shell?

946


What is the default shell of solaris?

1001


What is shell and terminal?

933


What are the different types of commonly used shells on a typical linux system?

1003


What is the equivalent of a file shortcut that we have a window on a linux system?

1066


What is the significance of the shebang line in shell scripting?

1044