Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
22
Task/Binary-digits/MAXScript/binary-digits.max
Normal file
22
Task/Binary-digits/MAXScript/binary-digits.max
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
-- MAXScript: Output decimal numbers from 0 to 16 as Binary : N.H. 2019
|
||||
for k = 0 to 16 do
|
||||
(
|
||||
temp = ""
|
||||
binString = ""
|
||||
b = k
|
||||
-- While loop wont execute for zero so force string to zero
|
||||
if b == 0 then temp = "0"
|
||||
while b > 0 do
|
||||
(
|
||||
rem = b
|
||||
b = b / 2
|
||||
If ((mod rem 2) as Integer) == 0 then temp = temp + "0"
|
||||
else temp = temp + "1"
|
||||
)
|
||||
-- Reverse the binary string
|
||||
for r = temp.count to 1 by -1 do
|
||||
(
|
||||
binString = binString + temp[r]
|
||||
)
|
||||
print binString
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue