Created
April 3, 2013 04:40
-
-
Save technoburst/5298493 to your computer and use it in GitHub Desktop.
Shell script to find the 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 | |
#Script to print the factorial of a number | |
echo "\nThis is a script to find the factorial of a number" | |
declare -i count result | |
echo "Enter a number : " | |
read num | |
count=$num | |
result=1 | |
while [ "$count" != "0" ]; do | |
result=result*count | |
count=count-1 | |
done | |
echo "factirial is $result" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment