Thread Notendurchschnitt-Berechner (20 answers)
Opened by The_Marv at 2010-10-29 15:06

topeg
 2010-10-29 15:34
#142329 #142329
User since
2006-07-10
2611 Artikel
BenutzerIn

user image
als Anregung:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/perl
use strict;
use warnings;

my @n;
while(<STDIN>)
{
  chomp;
  $_ or last;
  /^\d+(\.\d+)?/ or die("NO Number");
  push(@n,$_+0);
}

my $s=0; map{$s+=$_}@n; $s/=@n;
print "Durchschitt: $s\n";

View full thread Notendurchschnitt-Berechner