Skip to content

Instantly share code, notes, and snippets.

@manojjha
Created January 11, 2023 08:00
Show Gist options
  • Save manojjha/6b610a728a2a6cadd262a3491db8a893 to your computer and use it in GitHub Desktop.
Save manojjha/6b610a728a2a6cadd262a3491db8a893 to your computer and use it in GitHub Desktop.
Shell script to find factorial of a number
#!/bin/bash
echo "Enter a number:"
read num
fact=1
for((i=1;i<=num;i++))
do
fact=$((fact*i))
done
echo "The factorial of $num is $fact"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment