Monday, November 14, 2011

Shift Operator Divide Integer

Wap to use shift operator to divide an integer by 2.


#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a;
cout<<"enter a;
cin>>a;
cout<<(a<<1);
getch();
}

**************
OUTPUT:
enter a 14
28
**************

No comments:

Post a Comment