Created By: Hanan Mannan
Contact Number: Pak (+92)-321-59-95-634
--------------------------------------------------
Unix programming Binary to decimal conversion
------------------------------------------------------------============================== ====================
Hi Engineers/Programmers. if it has any errors than plz tell me alternatives solution.
============================== ====================
echo “Enter the size of the list”
read lst_size
cnt=0
while [ $cnt –lt $lst_size ]
do
echo “Enter” ` expr $cnt + 1` “th number for list”
read list[cnt]
let cnt=cnt+1
done
i=0
while [ $i –lt ` expr $lst_size – 1` ]
do
let j=i+1
let min=i
while [ $j –lt $lst_size ]
do
if [ ${list[$j]} –lt ${list[$min]} ]
then
let min=j
fi
let j=j+1
done
let temp=${list[$i]}
let list[$i]=${list[$min]}
let list[$min]=temp
let i=i+1
done
echo “The sorted list is given below”
k=0
while [ $k –lt $lst_size ]
do
echo ${list[$k]}
let k=k+1
done
Contact Number: Pak (+92)-321-59-95-634
--------------------------------------------------
Unix programming Binary to decimal conversion
------------------------------------------------------------==============================
Hi Engineers/Programmers. if it has any errors than plz tell me alternatives solution.
==============================
echo “Enter the size of the list”
read lst_size
cnt=0
while [ $cnt –lt $lst_size ]
do
echo “Enter” ` expr $cnt + 1` “th number for list”
read list[cnt]
let cnt=cnt+1
done
i=0
while [ $i –lt ` expr $lst_size – 1` ]
do
let j=i+1
let min=i
while [ $j –lt $lst_size ]
do
if [ ${list[$j]} –lt ${list[$min]} ]
then
let min=j
fi
let j=j+1
done
let temp=${list[$i]}
let list[$i]=${list[$min]}
let list[$min]=temp
let i=i+1
done
echo “The sorted list is given below”
k=0
while [ $k –lt $lst_size ]
do
echo ${list[$k]}
let k=k+1
done
0 comments:
Post a Comment