🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.perl
Article #52393

Re: wartości średnie

#52393
From: Marcin Gryszkalis
Date: Fri, 17 Feb 2012 13:06
26 lines
1331 bytes
Dnia 15.02.2012 o 22:24 MaW <niepisztu@aaa.bbb> napisał(a):
> hmmm a to nie jest zadanie na zaliczenie? jeśli nie to może tak

> for($i=0;$i<48;$i++)
> {
>    $suma =0;
>    for($j=0;$j<13;$j++)
>    {
>          $suma = $suma + $tablica[$i*13+$j];
>    }
>     $suma = $suma/13;print "$suma, ";
> }

Może mały golfik? ;)

for (@tablica)
{
	$suma += $_;
	next if ++$c%13;
	print $suma/13, " ";
	$suma = 0;
}

-- 
Marcin Gryszkalis, PGP 0x9F183FA3
jabber jid:mg@fork.pl, gg:2532994
Technical Details
Message-ID: <op.v9tqovjih3eus2@lodzdw17.multibank.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail
References: <17v68wsa698pf$.111ei49fwxocz$.dlg@40tude.net> <jhh7q9$gec$1@usenet.news.interia.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail
From: "Marcin Gryszkalis" <mg@fork.pl>
Newsgroups: pl.comp.lang.perl
Subject: Re: wartości średnie
Date: Fri, 17 Feb 2012 14:06:21 +0100
Organization: ATMAN - ATM S.A.
Lines: 28
Message-ID: <op.v9tqovjih3eus2@lodzdw17.multibank.pl>
References: <17v68wsa698pf$.111ei49fwxocz$.dlg@40tude.net> <jhh7q9$gec$1@usenet.news.interia.pl>
NNTP-Posting-Host: hq.fork.pl
Mime-Version: 1.0
X-Trace: node2.news.atman.pl 1329483982 11260 77.237.10.145 (17 Feb 2012 13:06:22 GMT)
X-Complaints-To: usenet@atman.pl
NNTP-Posting-Date: Fri, 17 Feb 2012 13:06:22 +0000 (UTC)
User-Agent: Opera Mail/11.61 (Win32)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit