RosettaCodeData/Task/Twos-complement/Ada/twos-complement.ada

11 lines
281 B
Ada

with Ada.Text_IO;
procedure Twos_Complement is
type Number is mod 2 ** 32;
A : constant Number := 42;
B : constant Number := not A + 1;
Is_Negative : constant Boolean := A + B = 0;
begin
Ada.Text_IO.Put_Line ("B = -A is " & Is_Negative'Image);
end Twos_Complement;