Power of 4 || Python
In this we are going to see a basic program to find if the given number is Power of 4 or not in Python Programming Language.


# Otherwise, return false.An integer n is a power of four, if there exists an integer x such that n == 4x.

from math import log,ceil,floor
def check(n):
    return ceil(log(n,4)) == floor(log(n,4))


print("The Number is power of 4?: ",check(int(input("Enter Number: "))))


# Coded by Saahil

#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post