diff --git a/script_LCM.sh b/script_LCM.sh index 87e2fd1..bde85bc 100755 --- a/script_LCM.sh +++ b/script_LCM.sh @@ -14,20 +14,4 @@ lcm() { if [ $# -ne 2 ]; then echo "Usage: $0 "; exit 1 fi -echo "НОК($1, $2) = $(lcm $1 $2)"#!/bin/bash -gcd() { - local a=$1 b=$2 - while [ $b -ne 0 ]; do - local temp=$b; b=$((a % b)); a=$temp - done - echo $a -} -lcm() { - local a=$1 b=$2 - local g=$(gcd $a $b) - echo $(( (a * b) / g )) -} -if [ $# -ne 2 ]; then - echo "Usage: $0 "; exit 1 -fi echo "НОК($1, $2) = $(lcm $1 $2)"