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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can a string be converted to a number?

512


What are runtime error?

623


Is array a primitive data type in c?

573


What are the different types of constants?

638


What are the functions to open and close the file in c language?

589






What is the use of bit field?

635


Can you please explain the scope of static variables?

597


write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);

1838


What are local static variables?

616


Write a code to determine the total number of stops an elevator would take to serve N number of people.

725


Explain how do you use a pointer to a function?

636


What is function prototype in c with example?

570


In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping

974


What is c language used for?

553


What is the difference between volatile and const volatile?

559