Q:

Write a PHP program to check if a given positive number is a multiple of 3 or a multiple of 7

0

Write a PHP program to check if a given positive number is a multiple of 3 or a multiple of 7

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

<?php
function test($n) 
{
   return $n % 3 == 0 || $n % 7 == 0;
}

var_dump(test(3));
var_dump(test(14));
var_dump(test(12));
var_dump(test(37));

Sample Output:

bool(true)
bool(true)
bool(true)
bool(false)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now