0
1.4kviews
What will be the output ?

Void main(){ int y; y = 0x10 + 010 + 10; printf(“\ny=%x”,y);}

A] y = 34
B] x = 34
C] y = 22
D] error.

Subject : Structured Programming Approach

Title : Fundamentals Of C-Programming

1 Answer
0
92views

Code:-
Void main() {
int y;
y = 0x10 + 010 + 10;
printf(“\ny=%x”,y);
}

Output:-
y=22

0X10 is a hexadecimal no which corresponds to 16 in decimal
010 is octal no which corresponds to 8 in decimal
10 is decimal no
16+8+10 = 34
34 is a decimal and its corresponding hexadecimal is 22

Please Improve formatting


Please log in to add an answer.