Assuming the popular 2's complement is used, the range is from -24 to +24 - 1.
Chat with our AI personalities
range iS given by -{2^(k-1) - 1 } to +{2^(k-1)-1} So putting k=7 range i from -63 to +63
A signed 16 bit number can represent the decimal numbers -32768 to 32767.
#include<stdio.h> #include<stdlib.h> main() { int number,binary[10000],b=0; printf("Enter decimal number "); scanf("%d",&number); printf("\nBinary: "); for(;number;number/=2,b++) binary[b]=number%2; for(b--;b>-1;b--) printf("%d ",binary[b]); }
binary.
31 - it's binary equivalent is 11111