main()
{
unsigned int k = 987 , i = 0;
char trans[10];
do {
trans[i++] =(char) (k%16 > 9 ? k%16 - 10 + 'a' : '\0' );
} while(k /= 16);
printf("%s\n", trans);
}

Answer Posted / lakshman

first case k=987, i=0.
trans[i++]=(char)(k%16>9?k%16-10+'a':''); means
trans [0]=char(987%16(=61)>9)condition is true so k%16-10+'a' value is print. that value is equal to 61-10|+(ascii value of a, that is equal to 97) so finally we get 98 and that is equal to b,
second case k=61, i=1 this will gives d
third case k=3, i=2 this gives null character.
the final answer is bd

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is indirection? How many levels of pointers can you have?

887


Tell me what are bitwise shift operators?

852


given post order,in order construct the corresponding binary tree

2521


What is the explanation for the dangling pointer in c?

872


What is a void pointer in c?

818






the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?

734


What are structural members?

757


Write a program which returns the first non repetitive character in the string?

800


Iam a B.Tech graduate and completed my engineering in 2009, from 2005 to 2009 and after that i had done nothing.Now i want to do job and get into BPO field . Friends give me suggestions as what to say in interview... if they ask me that what would you had done ... these many years without doing job ??????? pls urgent

1611


Was 2000 a leap year?

813


Find MAXIMUM of three distinct integers using a single C statement

799


Why main function is special give two reasons?

1183


What does d mean?

757


Which are low level languages?

821


What are logical errors and how does it differ from syntax errors?

871