main()
{
int a=5;
printf(?%d,%d,%d\n?,a,a< <2,a>>2);
}
Answer: 5,20,1 please explain this code in detail
Answer Posted / neha tibrewal ritm jaipur
firstly value of a is printed. value of a=5, so 5 is printed.
Now, a<<2 means 5<<2 i.e 5 is left shifted by 2.
in binary 5= 101
101<<2= 10100 and decimal value of 10100=20.
so, a<<2=20.
again, a>>2 means 5>>2 i.e 5 is right shifted by 2.
101>>2= 001 and decimal value of 1=1.
so, a>>2=1.
Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Is c pass by value or reference?
When can you use a pointer with a function?
hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .
What are the advantages of using new operator as compared to the function malloc ()?
Explain what is the purpose of "extern" keyword in a function declaration?
What is difference between main and void main?
What is structure in c definition?
What is a good data structure to use for storing lines of text?
What is the meaning of c in c language?
What is 1d array in c?
What are the data types present in c?
How can I find the modification date of a file?
What is the use of a conditional inclusion statement in C?
What is the -> in c?
What is the difference between the expression “++a” and “a++”?