L-R shift operator

Algorithm

Input	integer number
Output	Corresponding number after shifting
Complexity O(1)

L_R_Shift (a,s,ch) 
[‘a’ is any input number and s is the shift which needs to be done on 
the input number and ch takes the choice entered by user either for 
left shift or right shift]
1 if  ch='l' OR ch = ‘L’
2	   a=a<>s;
6 Print “a”
7 end

Algorithm Description

<< shows the left shift operator
>> shows right shift operator
left shift shifts every bit to the left by the number of positions and right shift shifts every bit to the right by the number of bits desired 

C Code

//Implement Left shift and Right Shift operator

#include< stdio.h>
#include< conio.h>
int main()
{
     int a,s;
     char ch;
     printf("Enter any number : ");
     scanf("%d",&a);
     printf("Enter type of shift (Left/Right) l or r : ");
     fflush(stdin);
     scanf("%c",&ch);
     printf("Enter no. of shifts : ");
     scanf("%d",&s);
     if(ch=='l' || ch=='L')
	     a=a<>s;
     else
     {
	     printf("Wrong choice entered!!!");
	     return 0;
     }
     printf("Result is : %d",a);
}