Show sourcecode
The following files exists in this folder. Click to view.
ovn_gr1.php
ovn_gr2.php
ovn_gr3.php
ovn_gr4.php
ovn_gr5.php
ovn_gr5.php
24 lines UTF-8 Unix (LF)
<?php
$title = "ovn_gr5.php";
include "../incl/header.php";
?>
<h1>Array med dubblerande tal</h1>
<?php
$tal = 1;
$list = [];
for ($i = 0; $i < 10; $i++) {
$list[$i] = $tal;
echo "<p>"."[".$i."] :" . $list[$i] . "</p>";
$tal *= 2;
}
echo "<h3>Medelvärde</h3>";
$len = count($list);
$avg = $tal/$len;
echo $avg;
?>
<?php include "../incl/footer.php"; ?>