feat: добавлен скрипт НОК и интерактивный main (#2)

Co-authored-by: Ermakov
Reviewed-on: #2
This commit is contained in:
2026-02-28 08:58:10 +03:00
parent f4c21e017b
commit 3289a60d34
2 changed files with 26 additions and 0 deletions

24
script_NOK.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
if [ $# -ne 2 ]; then
echo "Использование: $0 число1 число2"
exit 1
fi
a=$1
b=$2
# Находим НОД
nod_a=$a
nod_b=$b
while [ "$nod_b" -ne 0 ]; do
temp=$nod_b
nod_b=$((nod_a % nod_b))
nod_a=$temp
done
# НОК = (a * b) / НОД
nok=$(( (a * b) / nod_a ))
echo "$nok"