human
Subtract two numbers without using arithmetic operators | Python program to Subtract two numbers without using arithmetic operators.
Iterate till there is no carry.
borrow contains common set bits of y and unset bits of x.
Subtraction of bits of x and y where at least one of the bits is not set.
Borrow is shifted by one so that subtracting it from x gives the required sum.
Driver Code"
Solution in Python:
 What is a code to subtract two numbers without using arithmetic operators and the other steps required?
assistant
#Here is code to subtract two numbers without using arithmetic operators and the other steps required.
 def subtract ( x , y ) :
	while ( y != 0 ) :
		borrow = ( ~ x ) & y
		x = x ^ y
		y = borrow << 1
	return x
x = 29
y = 13
print ( " x ▁ - ▁ y ▁ is " , subtract ( x , y ) )