Write a PHP program to check whether two given integers are in the range 40..50 inclusive, or they are both in the range 50..60 inclusive.
<?php function test($x, $y) { return ($x >= 40 && $x <= 50 && $y >= 40 && $y <= 50) || ($x >= 50 && $x <= 60 && $y >= 50 && $y <= 60); } var_dump(test(78, 95)); var_dump(test(25, 35)); var_dump(test(40, 50)); var_dump(test(55, 60));
Sample Output:
bool(false) bool(false) bool(true) bool(true)
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer