merge: resolved conflict in main.sh

This commit is contained in:
Ermakov
2026-02-28 08:52:09 +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"