Two's compliment of -5

Answer Posted / vignesh1988i

first write the given number in it's binary format.
am considering only 8 bit at a time ,
5- 0000 0101
step 1: convert this binary format to one's compliment (ie)
change 0 to 1 and 1 to 0.
1111 1010

step 2: add 1 to the above binary format.

1111 1010
1
-----------
1111 1011

so this binary format will get stored in memory and the sign
bit will be set to 1.

always the negative number will be stored only in 2's
compliment..........


thank u

Is This Answer Correct ?    20 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the correct code to have following output in c using nested for loop?

617


What are the advantages of external class?

598


Where is volatile variable stored?

657


What is 02d in c?

641


What is c language and why we use it?

626






What does 3 mean in texting?

623


c language interview questions & answer

1465


Explain what is the benefit of using const for declaring constants?

620


Describe the modifier in c?

610


What is sizeof return in c?

619


Is c procedural or functional?

593


What's the right way to use errno?

628


write a progrmm in c language take user interface generate table using for loop?

1576


What are the output(s) for the following ? #include char *f() {char *s=malloc(8); strcpy(s,"goodbye")} main() { char *f(); printf("%c",*f()='A'); }

706


How to write a multi-statement macro?

629