PHP Menghitung Mean (Rata-rata)

<?php
$bil = array (9, 2, 10, 3, 7, 5, 2);

$i = 0;
echo “Data aslinya<br>”;
while(list($indeks,$nilai)=each($bil))
{
echo “$nilai  “;
$i=$i+1;
}
echo “<br>”;

for ($i=0; $i<=count($bil)-1; $i++)
{
$bilangan[$i]=$bil[$i];
$jumlah=$jumlah+$bilangan[$i];
}
echo “Rata-rata nya “.” = “.$jumlah/count($bil);
?>

One response to this post.

  1. Think of the way the contest will require an alternative simple strategy
    as opposed to money game.

    Balas

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google

You are commenting using your Google account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s

%d blogger menyukai ini: