Files
bash-lab/script_LCM.sh

18 lines
192 B
Bash
Executable File

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