text: Bitwise Operators in C / C ++ | C Program to demonstrate use of bitwise operators ; a = 5 ( 00000101 ) , b = 9 ( 00001001 ) ; The result is 00000001 ; The result is 00001101 ; The result is 00001100 ; The result is 11111010 ; The result is 00010010 ; The result is 00000100
code: #include <stdio.h> NEW_LINE int main ( ) { unsigned char a = 5 , b = 9 ; printf ( " a ▁ = ▁ % d , ▁ b ▁ = ▁ % d STRNEWLINE " , a , b ) ; printf ( " a & b ▁ = ▁ % d STRNEWLINE " , a & b ) ; printf ( " a ▁ b ▁ = ▁ % d STRNEWLINE " , a b ) ; printf ( " a ^ b ▁ = ▁ % d STRNEWLINE " , a ^ b ) ; printf ( " ~ a ▁ = ▁ % d STRNEWLINE " , a = ~ a ) ; printf ( " b < < 1 ▁ = ▁ % d STRNEWLINE " , b << 1 ) ; printf ( " b > > 1 ▁ = ▁ % d STRNEWLINE " , b >> 1 ) ; return 0 ; }