What is the output of the following code written in C? void main()
What is the output of the following code written in C?
void main()
{
printf("%d%d%d", 62, 062, 0x62);
}
Show answerHide answer
Correct answer: (C) 625098
Explanation
62 is decimal, 062 is octal = 6×8 + 2 = 50, and 0x62 is hexadecimal = 6×16 + 2 = 98. With no separators, the output is 625098.