You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
282 B
PHTML
16 lines
282 B
PHTML
5 years ago
|
<?php
|
||
|
function is_Power_of_two($n)
|
||
|
{
|
||
|
if(($n & ($n - 1)) == 0)
|
||
|
{
|
||
|
return "$n is power of 2";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return "$n is not power of 2";
|
||
|
}
|
||
|
}
|
||
|
print_r(is_Power_of_two(4)."\n");
|
||
|
print_r(is_Power_of_two(36)."\n");
|
||
|
print_r(is_Power_of_two(16)."\n");
|
||
|
?>
|