Computer Science, asked by rigzenthingh, 6 months ago

7 Write
a Python program to display
Binary operators with output​

Answers

Answered by Anonymous
1

Explanation:

a = 10 = 1010 (Binary)

b = 4 = 0100 (Binary

a & b = 1010

&

0100

= 0000

= 0 (Decimal)

Bitwise or operator: Returns 1 if either of the bit is 1 else 0.

Example:

a = 10 = 1010 (Binary)

b = 4 = 0100 (Binary

a | b = 1010

|

0100

= 1110

= 14 (Decimal)

Bitwise not operator: Returns one’s compliement of the number.

Example:

a = 10 = 1010 (Binary)

~a = ~1010

= -(1010 + 1)

= -(1011)

= -11 (Decimal)

Answered by thebrainlykapil
109

Syntax :

print (" WAP a program to display

Binary operators ")

x = int (input(" Enter the Value for x : "))

y = int (input(" Enter the Value for y : "))

print ("\n")

print ("\n")

z = x + y

print ( " ADDITION = " , z )

z = x - y

print ( " SUBSTRACTION = " , z )

z = x * y

print ( " MULTIPLACTION = " , z )

z = x / y

print ( " DIVISION = " , z )

z = x // y

print ( " FLOOR DIVISION = " , z )

z = x % y

print ( " MODULUS = " , z )

z = x * * y

print ( " EXPONENTIAL = " , z )

⠀⠀⠀⠀⠀⠀⠀⠀________________

Output :

WAP a program to display Binary operators

Enter the Value for x : 7

Enter the Value for y : 5

ADDITION = 12

SUBSTRACTION = 2

MULTIPLACTION = 35

DIVISION = 1.4

FLOOR DIVISION = 1

MODULUS = 2

EXPONENTIAL = 16807

⠀⠀⠀⠀⠀⠀⠀⠀________________

Attachments:
Similar questions