Files
laboratory_work1-DS-/script_GCD.sh
2026-02-27 19:01:47 +03:00

17 lines
218 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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