Friday, August 11, 2023

Binary value Program coding

INPUT:

 print(7&5)



"""

The & operator compares each bit and set it to 1 ifboth are 1, otherwise it is set to 0:

7=0000000000001111

5=0000000000000101

--------------------

5=0000000000000101

--------------------

Decimal numbers and their binary

0=0000000000000000

1=0000000000000001

2=0000000000000010

3=0000000000000011

4=0000000000000100

5=0000000000000101

6=0000000000000110

"""

print(6|3)



"""

The | operator compares the each bits are 1 if one of two bits is to 1.

6=0000000000000110

3=0000000000000011

--------------------

7=0000000000001111

--------------------

Decimal numbers OR their binary

0=0000000000000000

1=0000000000000001

2=0000000000000010

3=0000000000000010

4=0000000000000100

5=0000000000000101

6=0000000000000110

7=0000000000001111

"""

print(4^2)



"""

The ^ operator compares the sets each bit to 1 if only one of two bits is 1. 

4=000000000000100

2=000000000000010

--------------------

6=000000000000110

--------------------

0=0000000000000000

1=0000000000000001

2=0000000000000001

3=0000000000000010

4=0000000000000100

5=0000000000000101

6=0000000000000110

"""




USD TO INR C++ PROGRAMMING

  NALLAMUTHU GOUNDER MAHALINGAM COLLEGE                                                 POLLACHI-642001                                     ...