From 2ec3d6dd93e64bbfd0183f6b6c3a4530ae21c772 Mon Sep 17 00:00:00 2001 From: 24_PolevojVG <24_PolevojVG@iux.local> Date: Sat, 28 Feb 2026 10:46:48 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20NOK.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NOK.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/NOK.sh b/NOK.sh index e69de29..c11efbc 100644 --- a/NOK.sh +++ b/NOK.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# script_LCM.sh + +gcd() { + a=$1 + b=$2 + while [ $b -ne 0 ]; do + temp=$b + b=$((a % b)) + a=$temp + done + echo $a +} + +lcm() { + a=$1 + b=$2 + gcd_val=$(gcd $a $b) + echo $((a * b / gcd_val)) +} + +lcm $1 $2