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

This commit is contained in:
Ermakov
2026-02-28 08:34:09 +03:00
parent 49aeb710f3
commit 66b5b40ae8
2 changed files with 37 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"