This commit is contained in:
2p01
2025-05-28 11:21:16 +02:00
parent 2e0bb8c4ab
commit 4a12ac076e
9 changed files with 139 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
<?php
function jestOdkryta($liczba): bool
{
if ($liczba <= 0) {
return false;
}
$cyfry = str_split((string)$liczba);
foreach ($cyfry as $cyfra) {
if ($cyfra == '0') {
continue;
}
if ($liczba % (int)$cyfra != 0) {
return false;
}
}
return true;
}
echo "Zadanie P51a - Liczba odkryta<br>";
echo jestOdkryta(24) ? "True" : "False";