Two's compliment of -5
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / ramprasad g
ans: +5
-5 will be stored as 2's complement of 5
2's complement of -5, is thus 2 times 2's complement of 5.
so the ans is 5 itself.
| Is This Answer Correct ? | 11 Yes | 0 No |
2's compliment of a -ve no is, positive value of the same
no.
#include<stdio.h>
#include<conio.h>
void main()
{
int no1, res;
printf("ENTER THE NEGATIVE NO: \n");
scanf("%d", &no1);
no1 = ~(no1);
res = no1 | 0x01;
printf("\nRESULT: %d", res);
getch();
}
| Is This Answer Correct ? | 0 Yes | 5 No |
What is dynamic variable in c?
Explain indirection?
Implement a function that returns the 5th element from the end in a singly linked list of integers in one pass.
What are disadvantages of C language.
proc() { static i=10; printf("%d",i); } If this proc() is called second time, what is the output?
write a C program : To find out the number of identical words in two files . the file name should be taken as command line argument .
can any one tell that i have a variable which is declared as static but i want this variable to be visible to the other files? how?
to convert a string without using decrement operater and string functions
Should I use symbolic names like true and false for boolean constants, or plain 1 and 0?
what is meant by c
what is the output of the following code? main() { int I; I=0x10+010+10; printf("x=%x",I); } give detailed reason
Explain is it valid to address one element beyond the end of an array?