fork download
  1. import std.stdio;
  2.  
  3. void main()
  4. {
  5. int bitxor(int a, int b, int c) {
  6. return (a + b + c != 1) ? 0 : 1;
  7. }
  8.  
  9. int a, b, c;
  10.  
  11. a = b = c = 0;
  12.  
  13. foreach (i; 0 .. 8) {
  14. if (i > 3)
  15. a = 1;
  16. if (i == 2 || i == 3 || i == 6 || i == 7)
  17. b = 1;
  18. if (i % 2)
  19. c = 1;
  20. writeln(a, b, c, ' ', bitxor(a, b, c));
  21. a = b = c = 0;
  22. }
  23. }
Success #stdin #stdout 0.01s 2120KB
stdin
Standard input is empty
stdout
000 0
001 1
010 1
011 0
100 1
101 0
110 0
111 0