echo "Enter a number: "
read a
echo "Enter Power: "
read p
i=1
ans=1
while [ $i -le $p ]
do
ans=`expr $ans \* $a`
i=`expr $i + 1`
done
echo "Answer of $a^$p is $ans"
--------------------------------------------------------------------------------------------------------------
OUTPUT
Enter a number: 10
Enter Power: 3
Answer of 10^3 is 1000
0 comments:
Post a Comment