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
Can static variables be declared in a header file?
Explain what is the difference between null and nul?
What is auto keyword in c?
Explain how can I make sure that my program is the only one accessing a file?
What is selection sort in c?
What is size of union in c?
Write a program on swapping (100, 50)
What language is windows 1.0 written?
What is the concatenation operator?
What is optimization in c?
writ a program to compare using strcmp VIVA and viva with its output.
Explain output of printf("Hello World"-'A'+'B'); ?
If errno contains a nonzero number, is there an error?
What is s or c?
How do you determine the length of a string value that was stored in a variable?