what is bit wise or operators?

  1. we know that
  2.  0//0          =                 0
  3.  0//1           =                  1
  4.  1//0           =                  0

5.  1//1        =                1

In bit wise or operators we need to convert the operand 5 and 12 into binary.

5= 0 0 1 0 1

12= 0 1 1 0 0

# include<stdio.h>

#include<conio.h>

void main()

{

int x;

x=5//12;

printf(“%d”,x);

getch();

 

 

}

lets understand with explantion.

the binary of 5 = 00101

the binary of 12= 01100

and we perform or operation bit by bit from the right most.

1//0=1

0//0=0

1//1=1

0//1=1

0//0=0

so here is the solution

01101

so when we convert this binary digits into decimal then we got

13.

so the output is 13.hope you will understand

and stay tuned for my new articles.

Leave a Reply

Your email address will not be published. Required fields are marked *