Thread Kleines mathe-skript
(31 answers)
Opened by SirLant at 2003-09-02 16:39 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); } <!--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: Wie frage ich & perlintro brian's Leitfaden für jedes Perl-Problem |