]>
code.delx.au - gnu-emacs-elpa/blob - packages/realgud/test/gcd.pl
df476a891d40b5b48dc9fb1494327602277ec126
5 # GCD. We assume positive numbers
11 ($a, $b) = ($b, $a) if ($a > $b);
13 return undef if $a <= 0;
14 return $a if ($a == 1) or ($b-$a == 0);
15 return gcd
($b-$a, $a);
18 die sprintf "Need two integer arguments, got %d", scalar(@ARGV) unless
20 my ($a, $b) = @ARGV[0,1];
21 printf "The GCD of %d and %d is %d\n", $a, $b, gcd
($a, $b);