Skip to content

Instantly share code, notes, and snippets.

@luelista
Created December 28, 2010 23:03
Show Gist options
  • Save luelista/757870 to your computer and use it in GitHub Desktop.
Save luelista/757870 to your computer and use it in GitHub Desktop.
Punkte-Durchschnittsberechner
#!/bin/perl
# durchschnitt.pl
use strict;
print "Punkte-Durchschnittsberechner\n";
print '(c) Max Weller <[email protected]>',"\n\n";
die "Bitte gib den Punktespiegel absteigend ein\n" unless ($#ARGV>0);
my $i = 15;
my ($sum,$cnt);
for (@ARGV) {
$sum+= $i*$_;
$cnt+= $_;
print $i, " = ",$_, "\n";
$i--;
}
print "Durchschnitt: ",($sum/$cnt),"\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment