Question: Write a small program that takes a non-negative integer as its input and outputs two results, one having performed a single position left shift
Write a small program that takes a non-negative integer as its input and outputs two results, one having performed a single position left shift of the input's bits and the other a single position right shift of the input's bits. Once you have it working see what the results are with a few integer inputs and answer the following questions. Include your answer to the question as a comment at the end of your code. Using the sign-magnitude bit model, shifting to the left is the same as what simple mathematical operation? How about shifting to the right? Using shell commands to produce the results one at a time, examples of the results should be: On Linux: cbe@Laptop-Curtis:~$ cbe@Laptop-Curtis:~$ 8 14 On Windows: C:\Users\ccrbu>set /a "17>>1" 8 echo $((17 >> 1)) echo $((7 < < 1)) C:\Users\ccrbu>set /a "7 <
Step by Step Solution
There are 3 Steps involved in it
Heres a simple Python program that takes a nonnegative integer as input and performs a single positi... View full answer
Get step-by-step solutions from verified subject matter experts
