Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function isPowerOfTwo ($num) {
- $log = log($num,2);
- $diff = $log - round($log);
- $diff == 0 ? $output = "Число является степенью двойки" : $output = "Число — не степень двойки";
- return $output;
- }
Add Comment
Please, Sign In to add comment