fork download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int x, y, r;
  6. char o;
  7.  
  8. scanf("%d %c %d", &x, &o, &y);
  9.  
  10. if (o == '^')
  11. {
  12. r = x ^ y;
  13. }
  14. else if (o == '&')
  15. {
  16. r = x & y;
  17. }
  18. else if (o == '|')
  19. {
  20. r = x | y;
  21. }
  22.  
  23. printf("%d\n", r & 1);
  24.  
  25. return 0;
  26. }
Success #stdin #stdout 0s 5392KB
stdin
3 & 1
stdout
1