C program to check whether an integer number is power of two (2) or not
In this program, we will read an integer number and check whether the number is Power of Two (2) or not. For example number 12 is the power of two because it the multiple of 2.
The logic to implement this program - Divide number by 2 until number is not equal to 1, if in the loop remainder is not equal to 0 then number is not power of 2 otherwise number is power of 2.
Check Power of Two (2) using C program
Using User Define Function
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer