Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1) The following program is used to check if a given number is the power of 2 using bitwise operator. 5 6 7 8
1) The following program is used to check if a given number is the power of 2 using bitwise operator. 5 6 7 8 9 17 18 20 21 22 23 24 25 26 27 28 1234 in to00022222222223 10 11 12 13 #include define NUM_BITS INT (8*sizeof(int)) int power2 (unsigned int x) int i, count = 0, result, shift_num; for (i=0;i > 1; result shift_num & 1; if (res = 1) count++; 14 } 15 16 if (count 2 == 1) printf("YES"); else 19 printf("NO"); } 29 30 } int main() { unsigned int num; printf(" Enter Number"); scanf("%d", num); this.power2 (num); return 0; Which line(s) is (are) incorrect? And how to correct it(them)? Please write down your correction for that line (those lines).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started