Jump to content

Binary digits: Difference between revisions

add SETL
m (→‎{{header|Wren}}: Minor tidy)
(add SETL)
Line 5,371:
10000
</pre>
 
=={{header|SETL}}==
<syntaxhighlight lang="setl">program binary_digits;
loop for n in [5, 50, 9000] do
print(bin n);
end loop;
 
op bin(n);
return reverse +/[str [n mod 2, n div:=2](1) : until n=0];
end op;
end program;</syntaxhighlight>
{{out}}
<pre>101
110010
10001100101000</pre>
 
=={{header|SequenceL}}==
Line 5,387 ⟶ 5,402:
["101","110010","10001100101000"]
</pre>
 
=={{header|Sidef}}==
<syntaxhighlight lang="ruby">[5, 50, 9000].each { |n|
2,115

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.