about summary refs log tree commit diff
path: root/others/other/bin.pas
diff options
context:
space:
mode:
Diffstat (limited to 'others/other/bin.pas')
-rw-r--r--others/other/bin.pas24
1 files changed, 24 insertions, 0 deletions
diff --git a/others/other/bin.pas b/others/other/bin.pas
new file mode 100644
index 0000000..8543eda
--- /dev/null
+++ b/others/other/bin.pas
@@ -0,0 +1,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.