Alx09

Untitled

Oct 8th, 2019
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. { int a;
  6. printf("a= "); scanf("%d", &a);
  7. short int bit2 = 0, bit4 = 0;
  8. if(a & (1 << 1))bit2 = 1;
  9. if(a & (1 << 3))bit4 = 1;
  10.  
  11. if (bit2 != bit4){
  12. if(bit2) a = a & (255 -(1 << 1));
  13. else a = a | (1 << 1);
  14. if(bit4) a = a & (255 -(1 << 3));
  15. else a = a |(1 << 3);
  16. }
  17. printf("%i",a);
  18. system("pause")
  19.  
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment