Hello,
I want a batch code to output things like this:
0000
0001
0010
0011
0100
and so on...
I would appreciate any help,
I already have a code for testing some basic binary logics,
but still haven't found a code to give me the binary enters...
regards,
help with binary numbers and logics
Moderator: DosItHelp
Re: help with binary numbers and logics
If you want to convert a decimal number to binary, then this code do the trick:
Antonio
Code: Select all
@echo off
setlocal EnableDelayedExpansion
set /P "decimal=Enter decimal number: "
set binary=
for /L %%i in (1,1,32) do (
set /A "bit=decimal&1, decimal>>=1"
set binary=!bit!!binary!
)
echo The binary equivalent is: %binary%
Antonio