003-005-012
Bit Shift Operations
Hard
Problem Description
Bit Shift Operations
Learning Objective: Understand left shift (<<) and right shift (>>) operators
Overview
Use bit shift operators to efficiently multiply or divide by powers of 2.
Specifications
- Initialize variable
valuewith 8 - Output the result of shifting left by 2 bits (8 * 4 = 32)
- Output the result of shifting the original value right by 1 bit (8 / 2 = 4)
Output Format
Left shift: 32
Right shift: 4
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
