Left Shift and Right Shift Operators in C / C ++ | C ++ Program to demonstrate use of right shift operator ; a = 5 ( 00000101 ) , b = 9 ( 00001001 ) ; The result is 00000010 ; The result is 00000100
#include <iostream> NEW_LINE using namespace std ; int main ( ) { unsigned char a = 5 , b = 9 ; cout << " a > > 1 ▁ = ▁ " << ( a >> 1 ) << endl ; cout << " b > > 1 ▁ = ▁ " << ( b >> 1 ) << endl ; return 0 ; }