Function toBin(dec: integer): string; var buf: integer; str: string; begin buf := dec; repeat str := concat(IntToStr(buf mod 2), str); buf := buf div 2; until (buf = 0); toBin := str; end;
procedure toBin(dec: integer; var bin: string); var buf: integer; begin buf := dec; repeat bin := concat(IntToStr(buf mod 2), bin); buf := buf div 2; until (buf = 0); end;
var s: string;
begin writeln(toBin(10)); toBin(10, s); writeln(s); end.
var
buf: integer;
str: string;
begin
buf := dec;
repeat
str := concat(IntToStr(buf mod 2), str);
buf := buf div 2;
until (buf = 0);
toBin := str;
end;
procedure toBin(dec: integer; var bin: string);
var
buf: integer;
begin
buf := dec;
repeat
bin := concat(IntToStr(buf mod 2), bin);
buf := buf div 2;
until (buf = 0);
end;
var
s: string;
begin
writeln(toBin(10));
toBin(10, s);
writeln(s);
end.