The Question: To compare between 3 variables which is x=50, y=350 and z=250 and find the largest value and the smallest value between this 3 variables.
My answer:
<?php
$x = 50;
$y = 350;
$z = 250;
echo "x value is $x<br>";
echo "y value is $y<br>";
echo "z value is $z<br>";
if ($x > $y || $x >$z)
{
echo "Value x is $x";
echo "Value x is large than value y and z";
}
else if ($x < $y || $x < $z)
{
echo "Value x is $x";
echo "Value x is small than value y and z";
}
else if ($y > $x || $y >$z)
{
echo "Value y is $y";
echo "Value y is large than value x and z";
}
else if ($y < $x || $y < $z)
{
echo "Value y is $x";
echo "Value y is small than value x and z";
}
else if ($z > $x || $z < $y)
{
echo "Value z is $z";
echo "Value z is small than value x and y";
}
else if ($z < $x || $z < $y)
{
echo "Value z is $z";
echo "Value z is small than value x and y";
}
?>
i want to find a small and large number from this 3 number, but the output from this coding only the small number appear.... i want large and small number appear..is there anyone can help me or correct my prob and show whre wrong..?

New Topic/Question
Reply




MultiQuote





|