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 / manishsoni
#include<stdio.h>
#include<conio.h>
int main()
{
int a=5;
printf("%d,%d,%d\n",a,a<<2,a>>2);
getch();
return 0;
}
the ans is 5,20,1
How this ans is :
(1) a=5
(2) a=5
____________________
In digit |In binary|
__________|_________|
5 |101 |
__________|_________|
5<<2 |101<<2 |
__________|_________|
20 |10100 |
__________|_________|
(3)
____________________
In digit |In binary|
__________|_________|
5 |101 |
__________|_________|
5>>2 |101>>2 |
__________|_________|
1 |1 |
__________|_________|
----------------------------------------------------------|
<< is left shift operator and behave as : |
it shift the value left side and attached the 0 with right|
side. |
----------------------------------------------------------|
>> is right shift operator and behave as: |
it shift the value right side and attached the 0 with left|
side. |
----------------------------------------------------------
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Is the exit() function same as the return statement? Explain.
When should the register modifier be used? Does it really help?
What is array within structure?
How does #define work?
in any language the sound structure of that language depends on its a) character set, input/output function, its control structures b) character set, library functions, input/output functions its control structures c) character set, library functions, control sturctures d) character set, operators, its control structures
a c code by using memory allocation for add ,multiply of sprase matrixes
How can I recover the file name given an open stream or file descriptor?
What is the purpose of void in c?
while initialization of array why we use a[][2] why not a[2][]...?
PLS U SENS ME INTERVIEW O. MY EMAIL ADD, SOFIYA.SINGH@GMAIL.COM
What are the advantages and disadvantages of a heap?
Explain how do you determine whether to use a stream function or a low-level function?
What is c definition?
What is the main difference between calloc () and malloc ()?
Explain how do you convert strings to numbers in c?