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
Is shell and terminal the same?
How do I run a script on mac?
I want to monitor a continuously updating log file, what command can be used to most efficiently achieve this?
What are script files?
How many fields are present in a crontab file and what does each field specify?
What command needs to be used to take the backup?
What does $1 mean in bash?
How do I open a jshell in cmd?
What language is bash?
How would you compare the strings in a shell script?
What is the command to find out today's date?
Hello all, This is my assignment on shell scripting, can anyone help me regarding this ? Create a shell script which connects to the database In second shell script include the first script for the DB connection Create a table (PRADEEP_DATA) with 2 columns (name, value) In Third shell script include the first script for the DB connection And insert/delete the values from the Table, by accepting input from the user This functionality should be a menu driven Program: 1) Insert to the database a. Name b. value 2)Delete from the database a.Name b.value Exception handling needs to be taken care.
Explain about return code?
How will you copy a file from one machine to other?
Where is bash history?