Advertisement
danzylrabago

BoolLogic

Mar 25th, 2020
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. class challenge_two
  5. {
  6. public static bool logic(bool x, bool y)
  7. {
  8. bool answer;
  9. //Write your code below this
  10. //Hint: You can make extra variables if need be
  11. bool not_x = !x;
  12. bool xor_x = not_x ^ x;
  13. bool and_xy = xor_x && y;
  14. answer =! and_xy;
  15. return answer;
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement