This commit is contained in:
2026-04-18 14:42:00 +05:00
commit ef77f101fa
96 changed files with 3134 additions and 0 deletions

14
labLinux/lab3/factorial.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
factorial() {
if [ $1 -le 1 ]; then
echo 1
else
local prev=$(factorial $(( $1 - 1 )))
echo $(( $1 * prev ))
fi
}
read -p "Введите число: " n
result=$(factorial $n)
echo "Факториал $n равен $result"