Guest User

PexSign

a guest
Oct 16th, 2015
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. using System;
  2.  
  3. public class Program
  4. {
  5. // Pex for fun always selects the first comment line.
  6. public static int Puzzle(int i, int j)
  7. {
  8. if(sameSign(i,j)!=sameSign2(i,j))
  9. {
  10. throw new Exception();
  11. }
  12. return i;
  13. }
  14.  
  15. public static bool sameSign(int num1, int num2)
  16. {
  17. return num1 >= 0 && num2 >= 0 || num1 < 0 && num2 < 0;
  18. }
  19.  
  20. public static bool sameSign2(int num1, int num2)
  21. {
  22. return (num1 ^ num2) >= 0;
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment