Check for palindrome Click me to definition for Palindrome Code: clear echo -------------------------------- echo '\t Polindrome' echo -------------------------------- echo Enter the number read n x=$n s=0 while [ $n -gt 0 ] do r=$(expr $n % 10) s=$(expr $s \* 10 + $r) n=$(expr $n / 10) done if [ $s -eq $x ] then echo The given number is Polindrome. else echo The given number is not Polindrome. fi Output: -------------------------------- Polindrome -------------------------------- Enter the number 121 The given number is Polindrome.
Leave a Comment