RosettaCodeData/Task/Binary-digits/Delphi/binary-digits.delphi

19 lines
359 B
Plaintext

procedure Binary_Digits;
function IntToBinStr(AInt : integer) : string;
begin
Result := '';
while AInt > 0 do
begin
Result := Chr(Ord('0')+(AInt mod 2))+Result;
AInt := AInt div 2;
end;
end;
begin
writeln(' 5: '+IntToBinStr(5));
writeln(' 50: '+IntToBinStr(50));
writeln('9000: '+IntToBinStr(9000));
end;