to find complement of a number

Discussion in 'C++' started by vijaybaskar3108@gmail.com, Mar 25, 2007.

  1. Guest

    hi,
    I just want to know how to find complements for a number.
    These are the following answers for complements
    2's complement(10110)=01010
    4's complement(1230)=2110
    5's complement(4322)=0123
    please tell me how to do it.how this answers comes.This is a global
    edge question.
    please also tell me how to find 8's complement(7436)
    please alos tell me how to find 3's,4's,5's,6's,7's,8's complements.
    regards
    vijay
     
    , Mar 25, 2007
    #1
    1. Advertising

  2. On 2007-03-25 09:33, wrote:
    > hi,
    > I just want to know how to find complements for a number.
    > These are the following answers for complements
    > 2's complement(10110)=01010
    > 4's complement(1230)=2110
    > 5's complement(4322)=0123
    > please tell me how to do it.how this answers comes.This is a global
    > edge question.
    > please also tell me how to find 8's complement(7436)
    > please alos tell me how to find 3's,4's,5's,6's,7's,8's complements.


    Doesn't you textbook tell you that? And have you tried google? And what
    part of the questions concern C++? (Perhaps comp.programming would be
    more useful.) Before making your next post take a little while to read
    http://www.parashift.com/c -faq-lite/how-to-post.html, sections 5.2 and
    5.9 might be of special interest.

    --
    Erik Wikström
     
    =?ISO-8859-1?Q?Erik_Wikstr=F6m?=, Mar 25, 2007
    #2
    1. Advertising

  3. Hi there,

    The principle of making a compliment number is quite simple like
    binary calculation.

    If you wanna make a 2's compliment of 10110, it is 01010 because when
    you make a sum of 10110 and 01010 , the result becomes 100000.
    However, the digits were only 5 bits so we don't care about the 1 in
    the front. In addition, both number must be based on the same number
    system.

    I apologize about my bad explanation =P

    Here is another example...

    Let's do the 8's complement of 7436. 7436 is a number of base 8 so try
    to make 1 0000 in this time.

    7436(8) + 4(8) = 7440 (8)
    7440(8) + 40(8) = 7500 (8)
    7500(8) + 500(8) = 10000 (8)

    so the 8's complement of 7436 is 0544(8).

    Does it make sense to you?

    I hope you understand this.

    Cheers,


    On Mar 25, 5:33 pm, wrote:
    > hi,
    > I just want to know how to find complements for a number.
    > These are the following answers for complements
    > 2's complement(10110)=01010
    > 4's complement(1230)=2110
    > 5's complement(4322)=0123
    > please tell me how to do it.how this answers comes.This is a global
    > edge question.
    > please also tell me how to find 8's complement(7436)
    > please alos tell me how to find 3's,4's,5's,6's,7's,8's complements.
    > regards
    > vijay
     
    Alexander D. B. Kim, Mar 25, 2007
    #3
  4. You're little bit mean, mate =P Quire right though. =)

    Cheers,

    On Mar 25, 7:51 pm, Erik Wikström <> wrote:
    > On 2007-03-25 09:33, wrote:
    >
    > > hi,
    > > I just want to know how to find complements for a number.
    > > These are the following answers for complements
    > > 2's complement(10110)=01010
    > > 4's complement(1230)=2110
    > > 5's complement(4322)=0123
    > > please tell me how to do it.how this answers comes.This is a global
    > > edge question.
    > > please also tell me how to find 8's complement(7436)
    > > please alos tell me how to find 3's,4's,5's,6's,7's,8's complements.

    >
    > Doesn't you textbook tell you that? And have you tried google? And what
    > part of the questions concern C++? (Perhaps comp.programming would be
    > more useful.) Before making your next post take a little while to readhttp://www.parashift.com/c++-faq-lite/how-to-post.html, sections 5.2 and
    > 5.9 might be of special interest.
    >
    > --
    > Erik Wikström
     
    Alexander D. B. Kim, Mar 25, 2007
    #4
  5. Marvin825

    Joined:
    Aug 1, 2012
    Messages:
    1
    Question? Shouldn't it be 564? Instead of 544?
    He made a mistake in adding 7440 to make it 7500. :)
    Just want to inform you guys. Am studying the diminished radix and radix complement this semester. :)
     
    Marvin825, Aug 1, 2012
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mantorok Redgormor

    sign magnitude, ones complement, two's complement

    Mantorok Redgormor, Oct 5, 2003, in forum: C Programming
    Replies:
    8
    Views:
    8,725
    Glen Herrmannsfeldt
    Oct 8, 2003
  2. sarathy

    1's complement and 2's complement

    sarathy, Aug 1, 2006, in forum: C Programming
    Replies:
    20
    Views:
    2,248
    Bo Persson
    Aug 2, 2006
  3. sarathy
    Replies:
    22
    Views:
    2,409
    Bo Persson
    Aug 2, 2006
  4. Symon
    Replies:
    7
    Views:
    3,508
    Andy Rushton
    Apr 26, 2010
  5. Roberto Waltman

    2's complement vs. 1's complement vs. ...

    Roberto Waltman, Jun 9, 2011, in forum: C Programming
    Replies:
    4
    Views:
    1,407
    Michael Press
    Jun 14, 2011
Loading...

Share This Page