Write a PHP program to check if a given non-negative given number is a multiple of 3 or 7, but not both
<?php function test($n) { return ($n % 3 == 0) ^ ($n % 7 == 0); } var_dump(test(3)); var_dump(test(7)); var_dump(test(21));
Sample Output:
int(1) int(1) int(0)
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