A SHELL SCRIPT PROGRAM ON REVERSE OF A NUMBER - C C++ Java Programs - Examples

Latest

C C++ Java Python Perl Programs Examples with Output -useful for Schools & College Students

Wednesday, October 12, 2011

A SHELL SCRIPT PROGRAM ON REVERSE OF A NUMBER


A SHELL SCRIPT PROGRAM ON REVERSE OF A NUMBER
echo ".....A SHELL SCRIPT PROGRAM ON REVERSE OF A NUMBER ."
echo "     INPUT     "
echo "---------------"
echo "Enter A Number :"
read n
N=$n
rev=0
while [ $n -gt 0 ]
do
rem=`expr $n % 10`
rev=`expr $rev \* 10 + $rem`
n=`expr $n / 10`
done
echo "     OUTPUT     "
echo "---------------"
echo "Reverse of $N is $rev"


[root@localhost root]# sh reverseno.sh
.....A SHELL SCRIPT PROGRAM ON REVERSE OF A NUMBER.....
   INPUT
---------------
Enter A Number :
143
  OUTPUT
---------------
Reverse of 143 is 341

PL/SQL procedure successfully completed.

No comments:

Post a Comment