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
What is wrong with this program statement? void = 10;
Why does this code crash?
Describe the header file and its usage in c programming?
What is the stack in c?
What is the difference between variable declaration and variable definition in c?
Which are low level languages?
Can math operations be performed on a void pointer?
Can true be a variable name in c?
shorting algorithmS
what is bit rate & baud rate? plz give wave forms
What is wrong in this statement?
What are the types of macro formats?
What are the output(s) for the following ? #include char *f() {char *s=malloc(8); strcpy(s,"goodbye")} main() { char *f(); printf("%c",*f()='A'); }
What is modifier & how many types of modifiers available in c?
What is maximum size of array in c?