W.A.S.S to find the factorial of a given number.
Program
# W.A.S.S to find the factorial of a given number.
echo -e "enter number:\c" # \c Suppress trailing newline, –e Backslash-escaped
# characters is enabled
read number
i=1
f=1
while test $i -le $number
do
f=`expr $f \* $i` # expression is written in back quote because it will produce output at
# runtime
i=`expr $i + 1`
done # ‘done’ is completion of while loop
echo "factorial of number is:$f"
Output
enter number:4
factorial of number is:24