Main menu

Pages

 

أضغط هنا وسجل رقمك وانتظر مكلمه


 

أضغط هناوشاهد اسمك


How To Add and Subtract Binary Numbers


in this article we're going to focus on operations associated with binary numbers how do you add two binary numbers together how do you subtract them how do you multiply them how do you divide two binary numbers so let's start with the basics what's zero plus zero zero plus zero is zero now what about one plus zero how can we add those two binary numbers one plus zero is one now there's some other basic rules to go over what about one plus one in this case we need to carry over one plus one is going to be 0 but you need to carry over a 1. and so you get 1 0 so basically 1 0 has the decimal equivalent of 2. now what if you have three ones how can you add this in this case it's going to be one and you carry over a one let's write that here and so you get one one so if you have three ones in a single column it's going to produce an output of one one now let's work on some example problems go ahead and add these two binary numbers one zero one zero plus one zero zero one now the first thing you should do is you should line up these numbers and then add up the numbers column by column so here we have zero plus one which is one in the next column we have one plus zero which is also one and then for the third column zero plus one i mean that's zero plus zero rather which is a zero and then for the last one it's one plus one which is going to be based on the last two examples is zero but you need to carry over a one so you get one zero now to check the work let's convert each binary number into a decimal number so let's separate this into columns so this is 1 2 4 8 and 16. so 1 0 1 0 is going to have the decimal equivalent of this is going to be 8 plus 2 because it's in this column a plus 2 is 10. so that's the decimal equivalent of 1 0 1 0 here we have a an 8 and a 1 so a plus 1 is 9 10 plus 9 is 19. so here we have a 16 plus a 2 plus a 1 so that adds up to 19. and so we can see that we have the right answer so this is our answer right here so that's how you can add two binary numbers now let's go ahead and try another example go ahead and add these two binary numbers feel free to pause the video if you want to try this example so let's start with the column on the right side zero plus one is going to be one and then in the next column we have one plus zero which is one and then it's one plus one which is going to be a zero but we need to carry over one now for the fourth column it's one plus zero plus zero which will equal one and then we have zero plus one which is one and then next is one plus one which is zero but carry over a one to the next column which will give us one so now let's confirm our answer but let's separate everything into columns just like we did before so this is going to be 1 2 4 8 16 32 and 64. so let's get the decimal equivalent of the first number so we have a 32 plus a 4 plus a 2. 32 plus 4 is 36 plus 2 that's 38 and then for the next one we have a 32 plus 16 which is 48 48 plus 4 is 52 plus 1 that's going to be 53 now 8 plus 3 is 11 carry over the one 5 plus 3 is 8 plus 1 that's 9. so this should equal 91. so we have a 64 plus 16 so that's 80 plus 8 that's 88 plus 2 is 90 plus 191 so we can see that we do indeed get the right answer and so now you know how to add binary numbers as you can see it's not very difficult as long as you follow the process so make sure you remember these two things when adding 1 plus 1 you're going to get a 0 but you need to carry over a 1 to the next column and so the end result is that you get 1 0 and if you're adding 3 ones together it's going to be one but you carry over another one and so instead of getting one zero you get one one and if you remember these two things you can easily add two binary numbers together for the sake of practice let's work on another example so go ahead and add these numbers so feel free to take a minute pause the video and work on this example problem so let's start from the first column on the right side and work our way towards the left one plus one we know that it's going to give us zero but we need to carry over a one to the next column one plus zero plus zero is going to be one and then in the third column we have one plus one which is zero but we gotta carry over a one now for the fourth column we have three ones do you remember what we need to do if we encounter the situation if you have three ones in a single column it's gonna give you a one for that column but you need to carry over another one to the next column and so one plus zero plus one we could ignore the zero and so it's the same as one plus one which will give us a zero for that column but we got to carry over a one and for the last column we have three ones again so it's going to produce a one for that column but we need to carry over another one for the next column so one plus nothing is going to give us one and so this here is our final answer but as always let's confirm it so let's begin by drawing lines to separate the columns from each other and then let's write the powers of two two to the zero is one two to the one is two two squared is four two to the third power is eight two to the fourth power is 16 two to the fifth is thirty two and two to the sixth is sixty four so let's convert the first binary number into its decimal equivalent so we have a 32 plus 8 32 plus 8 is 40 plus 4 that's 44 plus 1 so that's a total of 45 next we have a 1 for the 32 columns that's 32 plus the one for the 16th column so 32 plus 16 that's 48 plus 8 that's 56 plus 4 that's 60 plus 1 and so that's going to be 61. now 1 plus 5 is 6 4 plus 6 is 10 so we get 106. now we have a 64 plus a 32 so that's 96 96 plus 8 is a 104 104 plus 2 is 106. and so our answer is indeed correct so this is the final answer right here 1 1 0 1 0 one zero now let's move on to our next topic that is how to subtract binary numbers so let's start with this what is one minus zero one minus zero is simply one now what about one minus one one minus one they cancel and that's zero now what if you have one zero but you wish to subtract it by one what will you do now one zero as a binary number is equivalent to two in the decimal uh system and one is just one in the decimal system so two minus one should give us an answer of one now we can't do zero minus one because that's going to give us a negative number so we need to borrow so we're gonna borrow this one that's gonna turn into a zero and then this zero becomes a two two minus one is one and zero minus nothing is zero so zero one corresponds to one now what if we have uh this situation let's say it's one zero zero minus one zero now this column is for the ones two and four so one zero zero is basically four and one zero is two four minus two is two so this is the answer we should get starting with the first column zero minus zero is zero now zero minus one we can't do that so we need to borrow a one so that's going to disappear that's going to change to zero and this becomes a two two minus one is one and you could bring the zero down if you want to zero one zero has the decimal equivalent of two so this answer is correct now let's try this one one zero zero minus one go ahead and subtract those two binary numbers so we can't do the first column zero minus one will give us a negative number so we need to borrow a one now we can't borrow anything from this column because it's a zero so we need to borrow a one from a column that has a one so this becomes a zero and this column becomes a two so anytime you cross that is zero replace it with a two it's going to work if you do it that way now we still need something in this column so let's borrow a one from the two so this becomes a one and this becomes a two now we can subtract so two minus one will give you one and then you can bring down the one here because there's nothing to subtract it one minus zero will be one and you can bring down the zero as well now let's check the work so one zero zero as a binary number has a decimal equivalent of four and here we just have one so four minus one is three now looking at this number this is one two four so we have a one with the two and one two plus one is three and so that tells us that we do have the right answer 

تعليقات


 

ابدا السحب من هنا



 

استلم الجائزة