Wednesday, 19 June 2013

Write a shell script to find the exponent of a number?



echo  “ enter 2 numbers”
read a
read b
ex = 1
i = 1
while [ $i – li $h ]
do
ex = `expr $ex \* $a `
i= `expr $i + 1`
done
echo “ $i exponent $b is $ex ”




OUTPUT:
Enter 2 numbers
5
2

5 exponent 2 is 25

No comments:

Post a Comment