Code:
echo Enter value for n:
read n
echo Enter value for y:
read y
iter=1
sum=1
while [ $iter -le $y ]
do
let sum=sum*n
let iter=$iter+1
done
echo $sum
Output:
[ty2011330@localhost ~]$ sh file21.sh
Enter value for n:
2
Enter value for y:
3
8
No comments:
Post a Comment