If cost price and selling price of am item is input through the keyboard, write a program to determine whether the seller has made profit or incurred loss. Also determine how much profit was made or loss incurred.
echo "Enter the cost price"
read cp
echo "Enter the selling price"
read sp
if [ $sp -gt $cp ]
then
profit=`expr $sp - $cp`
echo "Profit made is $profit"
else
loss=`expr $cp - $sp`
echo "Loss is $loss"
fi
Wednesday, January 14, 2009
Program in UNIX to determine whether the seller has made profit or incurred loss
Posted by ars at 6:41 AM
Subscribe to:
Post Comments (Atom)



0 comments:
Post a Comment