Basically, I just need this into a shell expression:
n x (n + 1) x (2n + 1)
______________________
6
My existing script uses a simple calcualtion but need to implement the above:
n x (n + 1) x (2n + 1)
______________________
6
My existing script uses a simple calcualtion but need to implement the above:
Code:
#!/bin/sh
echo "\n"
echo -------- Squares on a chessboard Calculator -------"\n"
echo "Simply, this calculator will return the number of
squares on a chessboard, according to the size of
the square chosen\n"
echo "Please enter a square size (1-8)...\n"
read SQUARE_SIZE
NO_SQUARES=`expr $SQUARE_SIZE + 5`
echo $NO_SQUARES
exit 0
~