function Parity(n: Integer): Integer;
var
Mask, I, Bits: Integer;
begin
Bits := 0;
for I := 0 to SizeOf(Integer)*8 - 1 do
begin
Mask := 1 shl I;
if ((n and Mask) <> 0) then Inc(Bits);
end;
Result := Ord(Odd(Bits));
end;
begin
writeln(Parity(42));
end.
function Parity(n: Int32): Integer;
begin
Result := Ord(Odd(PopCnt(DWORD(n))));
end;
var
i: Int32;
begin
i := 42;
writeln('Parity(42) = ',Parity(i));
end.
function Parity(n: Integer): Integer;
var
Mask, I, Bits: Integer;
begin
Bits := 0;
for I := 0 to SizeOf(Integer)*8 - 1 do
begin
Mask := 1 shl I;
if ((n and Mask) <> 0) then Inc(Bits);
end;
Result := Ord(Odd(Bits));
end;
begin
writeln(Parity(42));
end.
function Parity(n: Int32): Integer;
begin
Result := Ord(Odd(PopCnt(DWORD(n))));
end;
var
i: Int32;
begin
i := 42;
writeln('Parity(42) = ',Parity(i));
end.