SP – Reverse number

# Shell Programming

# Reverse a number

echo -n “Enter a number : ”

read n

ori=$n

i=0

while [ $n -gt 10 ]

do

mod=`expr $n % 10`

i=`expr $i \* 10 + $mod`

n=`expr $n / 10`

done

i=`expr $i \* 10 + $n`

echo “Entered Number : $ori”

echo “Reversed Number : $i”