Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/Binary-digits/Mercury/binary-digits.mercury
Normal file
17
Task/Binary-digits/Mercury/binary-digits.mercury
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
:- module binary_digits.
|
||||
:- interface.
|
||||
|
||||
:- import_module io.
|
||||
:- pred main(io::di, io::uo) is det.
|
||||
|
||||
:- implementation.
|
||||
:- import_module int, list, string.
|
||||
|
||||
main(!IO) :-
|
||||
list.foldl(print_binary_digits, [5, 50, 9000], !IO).
|
||||
|
||||
:- pred print_binary_digits(int::in, io::di, io::uo) is det.
|
||||
|
||||
print_binary_digits(N, !IO) :-
|
||||
io.write_string(int_to_base_string(N, 2), !IO),
|
||||
io.nl(!IO).
|
||||
Loading…
Add table
Add a link
Reference in a new issue