We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 7420e4c + 03916df commit 69df05eCopy full SHA for 69df05e
chapters/fundamental_algorithms/euclidean_algorithm/euclidean.md
@@ -269,6 +269,10 @@ namespace Euclidean_Algorithm
269
{
270
public static int EuclidSub(int a, int b)
271
272
+ // Math.Abs for negative number support
273
+ a = Math.Abs(a);
274
+ b = Math.Abs(b);
275
+
276
while (a != b)
277
278
if (a > b)
@@ -282,6 +286,10 @@ namespace Euclidean_Algorithm
282
286
283
287
public static int EuclidMod(int a, int b)
284
288
289
290
291
292
285
293
while (b != 0)
294
295
var temp = b;
0 commit comments