Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- sub euclid {
- ($b, $a) = @_;
- ($b, $a) = ($a, $b) if $b < $a;
- $d = int($b / $a);
- $r = $b % $a;
- print "\\indent{}\\indent{}\$$b = $d($a) + $r\$\\\\\n";
- euclid($a, $r) if $r;
- }
- euclid(@ARGV);
- print "\\indent{}\\indent{}gcd($ARGV[0], $ARGV[1]) = $a\\\\\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement