Hello, I am trying to solve a problem that has to do with bit representation and
ID: 3549310 • Letter: H
Question
Hello,
I am trying to solve a problem that has to do with bit representation and it has certain limits, as to what kind of controls and the amount that I can use for this particular problem. These controls linclude:
Using if, do, while, for, switch, etc.
defining additional functions
calling any functions
using any form of casting
using operations such as &&, ||, -, or ?:
using any data type other than int
defining or using macros
My goal is to replace the "return" statement in each function with one or more lines of c code that implements the function.
this is what I have come up with so far but am not having any luck:
Explanation / Answer
the problem is taking time but i can tell only what i think of the solution and not the complete solution.I do not expect point for this but the problem is interesting so i am posting this.
one has to use recursion(that i could not figure out how can one do it here) in that case we do the operation x^2 that is to do left bit-shift on x.and also y / 2 that is to do left bit shift on y.base case is y == 1.
so you have to implement right bit shift and left bit shift using only tildon and amphersend
if i am able to come up with this i will post it otherwise this is what i could come up with.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.