Answer to Question #293178 in UNIX/Linux Programming for Lavu

Question #293178

Write a shell script to determine if an input number is a palindrome or not.


1
Expert's answer
2022-02-05T02:04:32-0500
echo "Enter the number"
read nfunction pal{number=$nreverse=0while [ $n -gt 0 ]doa=`expr $n % 10 
`n=`expr $n / 10 
`reverse=`expr $reverse \* 10 + $a`
done
echo $reverseif [ $number -eq $reverse ]
then   
 echo "Number is palindrome"else   
 echo "Number is not palindrome"fi}r=`pal $n`echo 
"$r"

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS