Thread Mit Perl rechnen (76 answers)
Opened by Napstack at 2008-07-03 17:04

pq
 2008-07-04 17:15
#111825 #111825
User since
2003-08-04
12209 Artikel
Admin1
[Homepage]
user image
das kann doch nich so schwer sein, du hattest es doch schon fast... einzig und allein
eine if-bedingung hätte beim push noch gefehlt.
das skript von jd sieht sehr falsch aus:
Code (perl): (dl )
1
2
3
4
5
6
                if ($Zahl % $p == 0){
                        $is_prime = 0;
                        print $Zahl, "\n";
                        push @prime, $Zahl;
                        last;
                }

wenn es keine primzahl ist, wird das print und das push gemacht.
leute, bitte erstmal testen, bevor ihr skripte postet.
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 Mit Perl rechnen