Добавил скрипт для НОД

This commit is contained in:
daniladkin2007-wq
2026-02-27 19:01:47 +03:00
commit c91f2fc57e

16
script_GCD.sh Executable file
View File

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