# deci2bin.sh
# Program : To convert a decimal number into its binary equivalent.
# Author : sujith
# Date : 16/03/2015
echo
"Enter the num"
read n
val=0
power=1
while [
$n -ne 0 ]
do
r=`expr $n % 2`
val=`expr $r \* $power + $val`
power=`expr $power \* 10`
n=`expr $n \/ 2`
done
echo
"Binary equivalent=$val"
OUTPUT
[141740@localhost
~]$ sh deci2bin.sh
Enter the
num
6
Binary
equivalent=110
[141740@localhost
~]$ sh shellprime.sh
please make a script of reverse of the same.
ReplyDelete