about summary refs log tree commit diff
path: root/others/other/bin.pas
blob: 8543edaaf8f3f145834a61180ef5905d62fef4a3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var
  f: text;
  n: int64;
  s: string = '';

begin
  assign(f, 'BIN.INP');
  reset(f);
  readln(f, n);
  close(f);

  while n > 0 do
    begin
      s := chr(n mod 2 + 48) + s;
      n := n shr 1
    end;

  writeln(s);

  assign(f, 'BIN.OUT');
  rewrite(f);
  writeln(f, s);
  close(f)
end.