Question: Write a C program named lab2.c that implements the two functions NextPowerOfTwo() and WhichPowerOfTwo() described above. Requirements Your lab2.c program must meet the following requirements

Write a C program named lab2.c that implements the two functions NextPowerOfTwo() and WhichPowerOfTwo() described above. Requirements Your lab2.c program must meet the following requirements for full credit: 1. You must submit only a single file named lab2.c. 2. Your NextPowerOfTwo() function must accept an unsigned long int as input, return an unsigned long int, and use the bitwise left-shift operator <<. 3. Your WhichPowerOfTwo() function must accept an unsigned long int as input, return an int, and use the bitwise right-shift operator >>. 4. Your lab2.c program must #include only the library. 5. You must include the following main() function in your lab2.c program. int main() { unsigned long int a = NextPowerOfTwo(1650002446); printf("The first power of 2 above 1650002446 is: %ld ", a); int n = WhichPowerOfTwo(a); printf("%ld is 2 to the power of %d ", a, n); 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!