Checking if a number is power of two in Julia – ispow2() Method Last Updated : 01 Apr, 2020 Improve Improve Like Article Like Save Share Report The ispow2() is an inbuilt function in julia which is used to test whether the specified number n is a power of two or not. Syntax: ispow2(n::Integer) Parameters: n::Integer: Specified number. Returns: It returns true if the given number is power of 2 else false. Example 1: # Julia program to illustrate # the use of ispow2() method # Getting true if the given number # is power of 2 else false. println(ispow2(1)) println(ispow2(2)) println(ispow2(4)) println(ispow2(8)) Output: true true true true Example 2: # Julia program to illustrate # the use of ispow2() method # Getting true if the given number # is power of 2 else false. println(ispow2(3)) println(ispow2(5)) println(ispow2(7)) println(ispow2(9)) Output: false false false false Like Article Suggest improvement Previous Merging Dictionary collections in Julia - merge() and merge!() Methods Next Calculating smallest and largest an in Julia - nextpow() and prevpow() Methods Share your thoughts in the comments Add Your Comment Please Login to comment...