Begin var L := new List<integer>; var num := 41024 + 22046 - 15; var i := 65536; while i >= 1 do begin if (num and i) <> 0 then L.Add(1) else if (num and i) = 0 then L.Add(0); i := Trunc(i / 2); end; L.Println; // 0 1 1 1 1 0 1 1 0 0 1 0 0 1 1 1 1 L.Where(t -> t = 1).Count.Println; // 11 end.
var L := new List<integer>;
var num := 41024 + 22046 - 15;
var i := 65536;
while i >= 1 do begin
if (num and i) <> 0 then L.Add(1)
else if (num and i) = 0 then L.Add(0);
i := Trunc(i / 2);
end;
L.Println; // 0 1 1 1 1 0 1 1 0 0 1 0 0 1 1 1 1
L.Where(t -> t = 1).Count.Println; // 11
end.