Created
January 11, 2023 08:00
-
-
Save manojjha/6b610a728a2a6cadd262a3491db8a893 to your computer and use it in GitHub Desktop.
Shell script to find factorial of a number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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