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 |
How many main () function we can have in a project?
#include<stdio.h> main(0 { printf("\n %d %d %d",sizeof(3),sizeof("3"),sizeof(3)); }
Who is invented by c?
what is the return type of printf
How can I return multiple values from a function?
how to estimate the disk access time? e.g. the time between read one byte and another byte in the disk.
what is the basis for selection of arrays or pointers as data structure in a program
#include<stdio.h> #include<conio.h> void main() { int m=0111,n=20; printf("%d%d\n",m,n); getch(); }
main() { int i=0; while(+(+i--)!=0) i-=i++; printf(i); }
How can this be legal c?
Which header file is used for clrscr?
What is a memory leak in structures? How can we rectify that?