In this program user ask to define the left shift operator. Left Shift Operator The right operands value is moved left by the number of bits specified by the right operand. User declares required variables for storing the value. User put a condition to shift the bits from Right to left. Display result on the screen.
Problem Statement:
This is C Program that ask user to define a left shift operator with use of Logic.
- Declare variable.
- Using Method.
- Display result on the Screen.
Here is C source code for define the left shift bit wise operator. Output of this program shown below.
void main()
{
unsigned int Value=4; /* 4 = 0000 0100 */
unsigned int Shift=2;
Value = Value << Shift; /* 16 = 0001 0000 */
Value <<= Shift; /* 64 = 0100 0000 */
printf("Shifting Bits Left = %d\n", Value); /* Prints 64 */
}