Compare commits

...

2 Commits

Author SHA1 Message Date
Ermakov
a0b70ac926 merge: resolved conflict in main.sh 2026-02-28 08:52:09 +03:00
f4c21e017b feat: добавлен скрипт НОД и интерактивный main (#1)
Co-authored-by: Morozov
Reviewed-on: #1
2026-02-28 08:48:53 +03:00
2 changed files with 19 additions and 0 deletions

View File

@@ -8,6 +8,8 @@ read num1
echo "Введите второе число:"
read num2
nod_result=$("$SCRIPT_DIR/script_NOD.sh" "$num1" "$num2")
nok_result=$("$SCRIPT_DIR/script_NOK.sh" "$num1" "$num2")
echo "НОД($num1, $num2) = $nod_result"
echo "НОК($num1, $num2) = $nok_result"

17
script_NOD.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
if [ $# -ne 2 ]; then
echo "Использование: $0 число1 число2"
exit 1
fi
a=$1
b=$2
while [ "$b" -ne 0 ]; do
temp=$b
b=$((a % b))
a=$temp
done
echo "$a"