what is the output of the following code?
main()
{
int I;
I=0x10+010+10;
printf("x=%x",I);
}
give detailed reason

Answers were Sorted based on User's Feedback



what is the output of the following code? main() { int I; I=0x10+010+10; printf("x=%x"..

Answer / yogesh bansal

Output of this program is 22
reason is :
0x10 is hexadecimal value which is equal to 16 in decimal.
010 is octal value which is equal to 8 in decimal
10 is decimal value

so total is 16+8+10= 34

I value is 34.
Now we are printing the value of I on hexadecimal using %x
34 is equal to 0x22 in hexadecimal.

so the output is 22 in hexadecimal

Hope its is clear to you

Is This Answer Correct ?    70 Yes 8 No

what is the output of the following code? main() { int I; I=0x10+010+10; printf("x=%x"..

Answer / kartik

Output of this program is 22
reason is :
0x10 is hexadecimal value which is equal to 16 in decimal.
010 is octal value which is equal to 8 in decimal
10 is decimal value

so total is 16+8+10= 34

I value is 34.

Note:The person above me has given the corrst infm however the output is 34.
Try and run the program in C Compiler

Is This Answer Correct ?    12 Yes 7 No

what is the output of the following code? main() { int I; I=0x10+010+10; printf("x=%x"..

Answer / arpita

12

Is This Answer Correct ?    2 Yes 29 No

Post New Answer

More C Interview Questions

What is getch () for?

0 Answers  


The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration

0 Answers  


Do character constants represent numerical values?

0 Answers  


Write a Program to accept different goods with the number, price and date of purchase and display them

0 Answers   HDFC,


a=0; while(a<5) printf("%d\n",a++); how many times does the loop occurs? a.infinite b.5 c.4 d.6

7 Answers   TCS,






Eight queens puzzle

0 Answers  


What is logical error?

0 Answers  


write a code for large nos multilication (upto 200 digits)

2 Answers   Persistent,


explain what are actual arguments?

0 Answers  


How can we see the Expanded source code and compiled code for our source program in C?

1 Answers  


What is the use of function overloading in C?

0 Answers   Ittiam Systems,


Reverse the bit order in a single macro. eg. i/p = 10010101 --> o/p = 10101001

2 Answers  


Categories