GCD
Descriptionβ
Calculates the greatest common divisor (GCD) of two integers.
Syntaxβ
GCD(<a>, <b>)
Parametersβ
Parameter | Description |
---|---|
<a> | The first integer |
<b> | The second integer |
Return Valueβ
Returns the greatest common divisor of <a>
and <b>
.
Examplesβ
select gcd(54, 24);
+------------+
| gcd(54,24) |
+------------+
| 6 |
+------------+
select gcd(-17, 31);
+-------------+
| gcd(17,31) |
+-------------+
| 1 |
+-------------+
select gcd(0, 10);
+-----------+
| gcd(0,10) |
+-----------+
| 10 |
+-----------+