- 2

Out put of this code

int n = 0123; cout<<n;

16th Feb 2019, 2:21 PM
Shivam Malviya
Shivam Malviya - avatar
1 Answer
+ 18
When any number start with 0 the compiler treat it as octal number in general and if number start with 0x then it is hexadecimal number. So 0123 is an octal number so convert it in decimal will give 0123= 0*8^3+1*8^2+2*8^1+3*8^0 So it return 0+64+16+3=83 so output is 83 although you can run the code in playground and see the output
16th Feb 2019, 2:33 PM
GAWEN STEASY
GAWEN STEASY - avatar