Write a Shell Script to determine the factorial of “N” number?

Code:

echo "Enter any number"
read number
factorial= 1
while [ $number -gt 1]
do
  factorial= $(($factorial*number))
  n= $(($number - 1))
done
echo "Answer of Factorial is: " $factorial

Post a Comment

0 Comments