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 / saikumar

main()
{
int a=5;
printf("%d,%d,%d\n",a,a<<5,a>>2);
}
explanation:in the above program already we assinged a value is 5.
in the printf statement a is 5
and a<<2 it means 'a' leftshift 2 it should converted in to binary form .first we take 5 is in the binary form is 101.
and next we take 2 is in the binary form 010.
we have to shift the 5 to left side of 2 terms .
101<<010=10100=20.
101>>010=001=1.
output:
5
20
1

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is use of null pointer in c?

563


Explain what are linked list?

613


What functions are in conio h?

648


Can a file other than a .h file be included with #include?

675


Write a program to reverse a given number in c language?

608






Why is struct padding needed?

621


What are the types of data files?

719


What is the right way to use errno?

612


Is it possible to execute code even after the program exits the main() function?

801


What is volatile c?

512


Write a program for Overriding.

672


What is the purpose of type declarations?

673


What are structure types in C?

655


What is the use of ?

613


Where are some collections of useful code fragments and examples?

703