Compare commits
2 Commits
feature/gc
...
feature/gc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d4c3ee399 | ||
|
|
aad3bdba1e |
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Function to find GCD using Euclidean algorithm
|
||||||
gcd() {
|
gcd() {
|
||||||
local a=$1
|
local a=$1
|
||||||
local b=$2
|
local b=$2
|
||||||
@@ -14,12 +14,12 @@ gcd() {
|
|||||||
echo $a
|
echo $a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check arguments
|
||||||
if [ $# -ne 2 ]; then
|
if [ $# -ne 2 ]; then
|
||||||
echo "Usage: $0 <number1> <number2>"
|
echo "Usage: $0 <number1> <number2>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Call function and print result
|
||||||
result=$(gcd $1 $2)
|
result=$(gcd $1 $2)
|
||||||
echo "НОД($1, $2) = $result"
|
echo "НОД($1, $2) = $result"
|
||||||
|
|||||||
Reference in New Issue
Block a user