write a c program to find the complement and left shift and right shift by 2 of a value with ouput.
Answers
Answered by
2
Answer:
#include <stdio.h>
int main() {
int a = 20; /* 20 = 010100 */
int c = 0;
c = a << 2; /* 80 = 101000 */
printf("Left shift - Value of c is %d\n", c );
c = a >> 2; /*05 = 000101 */
printf("Right shift - Value of c is %d\n", c );
return 0;
}
Output:
Left shift - Value of c is 80
Right shift - Value of c is 5
Similar questions