Jak sprawdzić nawet lub nieparzysty numer w PHP
$num = 85;
if($num % 2 == 0){
echo "this is even number";
}else{
echo "this is odd number";
}
nk
$num = 85;
if($num % 2 == 0){
echo "this is even number";
}else{
echo "this is odd number";
}
$num = 34;
if ($num % 2 == 0) {
print "It's even";
}
<?php
for ($i=0; $i <=20 ; $i++) {
if ($i % 2 == 0) {
echo "$i";
echo "<br>";
}}
?><br>
<?php
for ($x=1; $x <=20; $x++){
if ($x%2 != 0) {
echo "$x";
echo "<br>";
}
}
?>