Question: The following program is used to check if a given number is the power of 2 using bitwise operator. #include define NUM_BITS_INT (8*sizeof(int)) int power2

 The following program is used to check if a given number

The following program is used to check if a given number is the power of 2 using bitwise operator. #include define NUM_BITS_INT (8*sizeof(int)) int power2 (unsigned int x) {int i, count = 0, result, shift_num; for (i = 0;i > i; result = shift_num & 1; if (res = 1) count++;} it (count % 2 == 1) printf("YES"); else printf("NO");} int main() {unsigned int num; printf(" Enter Number"); scanf("%d", num); this.power2(num); return 0;}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!