mirror of
https://github.com/autistic-symposium/shell-whiz-toolkit.git
synced 2025-05-14 20:52:17 -04:00
some sytem scripts
This commit is contained in:
parent
4b0a965e4a
commit
5852171b21
25 changed files with 639 additions and 1 deletions
18
shell_scripts/lessons/factorial.sh
Executable file
18
shell_scripts/lessons/factorial.sh
Executable file
|
@ -0,0 +1,18 @@
|
|||
#! /bin/bash
|
||||
|
||||
n=0
|
||||
on=0
|
||||
fact=1
|
||||
|
||||
echo -n "Enter number to find factorial : "
|
||||
read n
|
||||
|
||||
on=$n
|
||||
|
||||
while [ $n -ge 1 ]
|
||||
do
|
||||
fact=`expr $fact \* $n`
|
||||
n=`expr $n - 1`
|
||||
done
|
||||
|
||||
echo "Factorial for $on is $fact"
|
Loading…
Add table
Add a link
Reference in a new issue