Thread Kleines mathe-skript (31 answers)
Opened by SirLant at 2003-09-02 16:39

pq
 2003-09-02 17:57
#82979 #82979
User since
2003-08-04
12194 articles
Admin1
[Homepage]
user image
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
my $ggt = ggt($x, $y);
print "ggt: $ggt";
my $kgv = ($x / $ggt) * $y;
print "kgv: $kgv";
sub ggt {
  my ($x,$y) = @_;
  ($x,$y) = ($y,$x) if $y > $x;
  return 1 if ($y < 2);
  return $y if ($x % $y) == 0;
  $x -= $y;
  my $ggt = ggt($x,$y);
}
\n\n

<!--EDIT|pq|1062517026-->
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem

View full thread Kleines mathe-skript