Bit-wise Left Shift Operator



    # include <iostream.h>
    void main ()
    {
        int a = 10 , b = -10 ;

        cout<<"a = "<<a<<endl ;
        a = a << 3 ;
        cout <<"Value of a,left-shifted 3 times = "<<a<<endl ;

        cout <<"b = " <<b<<endl;
        b = b << 2 ;
        cout <<"Value of b,left-shifted 2 times = "<<b<<endl;
    }

No comments:

Post a Comment