Google Search

Thursday, October 6, 2011

Write a shell script that computes the gross salary of a employee


a) Write a shell script that computes the gross salary of a employee according to the following

1) if basic salary is <1500 then HRA 10% of the basic and DA =90% of the basic
2) if basic salary is >1500 then HRA 500 and DA =98% of the basic
The basic salary is entered interactively through the key board

(b)Write a shell script that accepts two integers as its arguments and computes the value of first number raised to the power of the second number

echo " Enter the Salary "
read sal
if [ $sal<1500] then
da=`expr  $sal*90/100`
hra=`expr $sal*10/100`
gsal=’expr $sal +$hra+$da
echo “$gsal”
elif [$sal>1500]
hra=500
da=’expr $sal*98/100’
gsal=’expr $sal+$hra+$da
gross=`expr $sa + $da + $hra`
fi
fi


(b)
a=$1
b=$2
c=pow($a,$b)
echo”$c”

0 comments:

Post a Comment