Explanation Note: In int n1:1; 'int' is a signed ineger and ':1' fix the width of n1 to 1 bit.
1 means -ve, 0 means +ve
Ex. n1=1; binary of one is 1, left most bit is 1, so -ve number.
printed value will be the 2's complement of 1 with -ve sign. i.e -1
In case of int n2:4; and n2=15;
Binary of 15(4 bit) => 1111, left most bit is 1, so -ve,
2's complement of 1111 => 1's complement + 1
=> 0000 + 1
=> 1
printed value = -1 ( 2's complement with -ve sign)
In case of int n2:4; and n2=15;
Binary of 15(5 bit) => 01111, left most bit is 0, so +ve,
If +ve, it will be printed without any conversion i.e 15