Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- { int a;
- printf("a= "); scanf("%d", &a);
- short int bit2 = 0, bit4 = 0;
- if(a & (1 << 1))bit2 = 1;
- if(a & (1 << 3))bit4 = 1;
- if (bit2 != bit4){
- if(bit2) a = a & (255 -(1 << 1));
- else a = a | (1 << 1);
- if(bit4) a = a & (255 -(1 << 3));
- else a = a |(1 << 3);
- }
- printf("%i",a);
- system("pause")
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment