Thread Rechenproblem (8 answers)
Opened by bianca at 2011-05-15 16:08

bianca
 2011-05-15 16:32
#148624 #148624
User since
2009-09-13
6978 Artikel
BenutzerIn

user image
So funktioniert es.
Es variiert zwar bis 19 das macht aber nichts.

Frage nur, ob das auch eleganter geht?
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/perl -w
use strict;
use warnings;

my $max = 10;
my $anzahl = 20;

my $lfd = 0;
foreach my $nr (1..$anzahl) {
    if (
        $anzahl <= $max
            ||
        int ($nr / int ($anzahl / $max)) == $nr / int ($anzahl / $max)
    ) {
        $lfd ++;
        print "Nr. $nr kommt rein, Anzeige Nr. $lfd\n";
    }
}
10 print "Hallo"
20 goto 10

View full thread Rechenproblem