Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The following program is used to check if a given number is the power of 2 using

ID: 3808882 • Letter: T

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 (unsigned int x) {int i, count = 0, result, shift_num; for(i = 0; i > i; result = shift_num & 1; if (res = 1) count++;} if (count % 2 -- 1) printf("YES"); else printf("NO");} 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). The following shell script is used to count the number of positives integer, negative integer entered in command line./bin/sh countPos=0 countNeg=0 for num in S# do if [num > 0] then countpos='expr ScountPos+1 elif [num

Explanation / Answer

line 12: res is not declared.

   correct:
       if(result == 1)
           count++;

line 16:
   Correct:
       if(count%2 == 0)
           printf("yes");
       else
           printf("no");