Question: PROBLEM 2: Below is a (trivial) C function which returns the square of its parameter (a non-negative integer): unsigned int square(unsigned int n) { return





PROBLEM 2: Below is a (trivial) C function which returns the square of its parameter (a non-negative integer): unsigned int square(unsigned int n) { return n*n; Your job: write a function which also returns n but with the following constraints: You cannot use the multiplication operator , . You cannot use the division operator . You cannot have any loops . You cannot add any additional parameters to the function .Your function must be self-contained: no helper functions! . You cannot use any globals . You cannot use any static variables However,... You can use recursion You can use the 4, and -' operators
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
