Merge branch 'feature-bash-scripts'

This commit is contained in:
24_NovikovDA
2026-02-27 16:00:23 +00:00
2 changed files with 28 additions and 0 deletions

11
main.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
echo "Введите 1е число:"
read num1
echo "Введите 2е число:"
read num2
echo "Результаты:"
./GCD.sh $num1 $num2
./script_LCM.sh $num1 $num2

17
script_LCM.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
a=$1
b=$2
temp_a=$a
temp_b=$b
while [ $temp_b -ne 0 ]; do
temp=$temp_b
temp_b=$((temp_a % temp_b))
temp_a=$temp
done
gcd=$temp_a
lcm=$(( (a * b) / gcd ))
echo $lcm