Data update
This commit is contained in:
parent
ed705008a8
commit
0df55f9f24
2196 changed files with 32999 additions and 3075 deletions
|
|
@ -1,14 +1,11 @@
|
|||
func$ bin num .
|
||||
b$ = ""
|
||||
if num = 0
|
||||
b$ = "0"
|
||||
.
|
||||
while num > 0
|
||||
while num > 1
|
||||
b$ = num mod 2 & b$
|
||||
num = num div 2
|
||||
.
|
||||
return b$
|
||||
return num & b$
|
||||
.
|
||||
print bin 2
|
||||
print bin 5
|
||||
print bin 50
|
||||
print bin 9000
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import extensions;
|
|||
|
||||
public program()
|
||||
{
|
||||
new int[]{5,50,9000}.forEach:(n)
|
||||
new int[]{5,50,9000}.forEach::(n)
|
||||
{
|
||||
console.printLine(n.toString(2))
|
||||
}
|
||||
|
|
|
|||
15
Task/Binary-digits/Refal/binary-digits.refal
Normal file
15
Task/Binary-digits/Refal/binary-digits.refal
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
$ENTRY Go {
|
||||
= <Prout <Binary 5>
|
||||
<Binary 50>
|
||||
<Binary 9000>>;
|
||||
};
|
||||
|
||||
Binary {
|
||||
0 = '0\n';
|
||||
s.N = <Binary1 s.N> '\n';
|
||||
};
|
||||
|
||||
Binary1 {
|
||||
0 = ;
|
||||
s.N, <Divmod s.N 2>: (s.R) s.D = <Binary1 s.R> <Symb s.D>;
|
||||
};
|
||||
6
Task/Binary-digits/Roc/binary-digits.roc
Normal file
6
Task/Binary-digits/Roc/binary-digits.roc
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
binstr : Int * -> Str
|
||||
binstr = \n ->
|
||||
if n < 2 then
|
||||
Num.toStr n
|
||||
else
|
||||
Str.concat (binstr (Num.shiftRightZfBy n 1)) (Num.toStr (Num.bitwiseAnd n 1))
|
||||
Loading…
Add table
Add a link
Reference in a new issue