<?php
// This is my first PHP lab01
$n = 0;
$i = 0;
$s = 0;
echo "Please enter value for N\n";
$n = (int)readline();
$s = 0;
for ($i = 1; $i <= $n; $i+=1)
{
if ($i % 2 == 0)
{
$s=$s+$i;
echo ("Current value i=" . $i . " S=" . $s);
echo ("\n");
}
}
echo ("Final result suma is S=" . $s);
?>
PD9waHAKLy8gVGhpcyBpcyBteSBmaXJzdCBQSFAgbGFiMDEKCiRuID0gMDsKJGkgPSAwOwokcyA9IDA7CgoKZWNobyAiUGxlYXNlIGVudGVyIHZhbHVlIGZvciBOXG4iOwokbiA9IChpbnQpcmVhZGxpbmUoKTsKJHMgPSAwOwoKCmZvciAoJGkgPSAxOyAkaSA8PSAkbjsgJGkrPTEpIAp7CiAgICBpZiAoJGkgJSAyID09IDApIAogICAgewogICAgICAgICRzPSRzKyRpOwogICAgICAgIGVjaG8gKCJDdXJyZW50IHZhbHVlIGk9IiAuICRpIC4gIiBTPSIgLiAkcyk7CiAgICAgICAgZWNobyAoIlxuIik7CiAgICB9Cn0KCmVjaG8gKCJGaW5hbCByZXN1bHQgc3VtYSBpcyBTPSIgLiAkcyk7Cj8+