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

Multiply an Integer Number by 2 Without Using Multiplication Operator

0 Answers  


a) Identify the following declarations. Ex. int i (integer variable) float a[l0](array of 10 real nos) int (*f())() void *f int (*f()) [] void *f int f[] [] [] char *(*f) () int (*f[]) [] float(*f) [] [] float **f int ******f

0 Answers   TCS,


how logic is used

0 Answers  


Write a C program that defines a 2-dimentional integer array called A [50][50]. Then the elements of this array should randomly be initialized either to 1 or 0. The program should then print out all the elements in the diagonal (i.e. a[0][0], a[1][1],a[2][2], a[3][3], ……..a[49][49]). Finally, print out how many zeros and ones in the diagonal.

3 Answers   Infosys,


What is the use of a semicolon (;) at the end of every program statement?

1 Answers  






totally how much header files r in c language

8 Answers   TCS,


program to find a smallest number in an array

15 Answers   Microsoft, Sony,


what is the output of the code and how? main() { int *ptr,x; x=sizeof(ptr); printf("%d",x); }

1 Answers  


How do shell structures work?

0 Answers  


write a program to display the numbers having digit 9 in the given range from 1 to 100

1 Answers  


What are multibyte characters?

0 Answers  


Explain what is page thrashing?

0 Answers  


Categories