Webbserverprogrammering 1

Show sourcecode

The following files exists in this folder. Click to view.

webbsrvprg/exercises/Grunder/

index.php
ovn_gr1.php
ovn_gr2.php
ovn_gr3.php
ovn_gr4.php
ovn_gr5.php
ovn_gr6.php
ovn_gr7.php

ovn_gr6.php

33 lines ASCII Windows (CRLF)
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <?php

$antal 
= 0;

for (
$tal = 2; $tal <= 100; $tal++) {

    
$delare = 0;

    for (
$i = 1; $i <= $tal; $i++) {
        if (
$tal % $i == 0) {
            
$delare++;
        }
    }

    if (
$delare == 2) {
        echo 
$tal . "<br>";
        
$antal++;
    }
}

echo 
"Antal primtal: " . $antal;

?>
</body>
</html>