Answers for "bash script which displays the Factorial of a number N on the monitor"

0

bash script which displays the Factorial of a number N on the monitor

#shell script for factorial of a number
#factorial using while loop

echo "Enter a number"
read num

fact=1

while [ $num -gt 1 ]
do
  fact=$((fact * num))  #fact = fact * num
  num=$((num - 1))      #num = num - 1
done

echo $fact
Posted by: Guest on July-20-2021

Code answers related to "bash script which displays the Factorial of a number N on the monitor"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language