Python 3 Script to Implement Full Subtractor in Digital Logic

Python 3 Script to Implement Full Subtractor in Digital Logic

Python 3 Script to Implement Full Subtractor in Digital Logic

# python program to implement full Subtractor
# Function to print Difference and B-Out

def getResult(A, B, Bin):

    # Calculating value of Difference
    Difference = (A ^ B) ^ Bin
    
    # calculating NOT value of a
    A1 = not(A)
    
    # Calculating value of B-Out
    B_Out = A1 & Bin | A1 & B | B & Bin

    # printing the values
    print("Difference = ", Difference)
    print("B-Out = ", B_Out)


# Driver code
A = 0
B = 1
Bin = 1
# passing three inputs of fullsubtractor as arguements to get result function
getResult(A, B, Bin)
Share on:

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Comment