0
Odd or even with function
<?php Function OE($a){ $b=$a%2; return$a ; if (b==0) echo "even" ; else echo " odd" ; } echo OE(88); ?>
11 Answers
+ 2
here is the correct one. no need for return $a and no need for $b
<?php
Function OE($a){
$a=$a%2 ;
if ($a==0){
echo "even" ;
}else{
echo " odd" ;
}
}
echo OE(88 );
?>
+ 1
is this a question or what?
+ 1
Is this program ok?
Determine the even or odd number
+ 1
/ wrong
%
True
+ 1
Replacing the / with %, doesnt yet fix the program, because you have return statement, which will break the function call before the if-else statement is reached.
+ 1
I want with function for program
+ 1
% is remind for number
I think true
+ 1
My from iran
0
I think it's wrong.
n/2 == 0 does not mean that n is even.
0
az iran
0
az iran