Shell programming - Squares and cubes up to given number

# Shell programming
# Squares and Cubes up to given number

echo -n "Enter a number : "
read n
echo -e "\t Number \t Square \t Cube"
i=1
while [ $i -le $n ]
do
sq=`expr $i \* $i`
cu=`expr $i \* $sq`

echo -e "\t $i \t\t $sq \t\t $cu "
i=`expr $i + 1`
done

No comments:

Post a Comment

Don't be a silent reader...
Leave your comments...

Anu