How to check if two integers have opposite signs in Pascal

1 Answer

0 votes
program BitwiseSignCheck;

var
  x, y: Integer;
  b: Boolean;

begin
  x := 3;
  y := -9;
  b := (x xor y) < 0;
  WriteLn(Ord(b));

  x := 5;
  y := 6;
  b := (x xor y) < 0;
  WriteLn(Ord(b));
end.




(*
run:
  
1
0
  
*)

 



answered Jul 24, 2025 by avibootz

Related questions

...