Sunday 10 August 2014

Write a shell script that accepts two integers as its argument and compute the value of first number raised to the power of second number.


if [ $# -ne 2 ]
then
echo "Invalid number of arguments"
exit
fi
pwr=`echo $1^$2 |bc`
echo "$1 raised to $2 is : $pwr"

0 comments:

Post a Comment

 
- |