merge: resolved conflict in main.sh
This commit is contained in:
2
main.sh
2
main.sh
@@ -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
17
script_NOD.sh
Executable 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"
|
||||
Reference in New Issue
Block a user