Add LCM script and update main

This commit is contained in:
2026-02-26 22:40:43 +03:00
parent 73ab79e6ba
commit 748c775066
2 changed files with 21 additions and 1 deletions

18
script_LCM.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/bash
if [ $# -ne 2 ]; then
echo "error, pls write 2 arguments"
exit 1
fi
a=$1
b=$2
GCD=$(bash ./script_GCD.sh $a $b | head -n1)
if ! [[ "$GCD" =~ ^[0-9]+$ ]]; then
echo "Error"
exit 1
fi
echo $(( ($a * $b) / $GCD ))