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 does the file stdio.h contain?

582


main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }

615


Explain what is a 'locale'?

565


Synonymous with pointer array a) character array b) ragged array c) multiple array d) none

591


What is the difference between struct and union in C?

533






What is data structure in c and its types?

570


List the difference between a 'copy constructor' and a 'assignment operator' in C?

612


How can I call a function with an argument list built up at run time?

601


Describe static function with its usage?

583


main() { printf("hello"); fork(); }

667


How do you sort filenames in a directory?

680


What is difference between constant pointer and constant variable?

599


Explain what is wrong with this program statement? Void = 10;

744


What are global variables?

625


What are the different data types in C?

701