text: 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
code: #include <stdio.h> NEW_LINE using namespace std ; int main ( ) { unsigned char a = 5 , b = 9 ; printf ( " a > > 1 ▁ = ▁ % d STRNEWLINE " , a >> 1 ) ; printf ( " b > > 1 ▁ = ▁ % d STRNEWLINE " , b >> 1 ) ; return 0 ; }