In this program user ask to define the left shift operator. Left Shift Operator The left 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 c3 = c1<<2. 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.
# include<stdio.h>
void main()
{
int c1 = 1,c3 = 3;
clrscr();
c3 = c1<<2;
printf("\nLeft Shift by 2 Bits c1 << 2 = %d",c3);
getch();
}