Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void showBits(unsigned a){
- int i;
- for(i=sizeof(a)*8-1;i>=0;i--)
- printf("%d",(a>>i)&1);
- printf("\n");
- }
- int main() {
- unsigned x;
- printf("x="); scanf("%u", &x);
- showBits(x);
- x |= (1 << 0) | (1 << 2) | (1 << 3);
- x &= ~((1 << 1) | (1 << 5) | (1 << 6));
- x ^= (1 << 4) ^ (1 << 7);
- showBits(x);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement