Skip to main content
added 10 characters in body
Source Link
Neil
  • 177.3k
  • 12
  • 74
  • 281

Batch, 265 262 242 236236 235 bytes

@echo off
set/pn=
set c=%n%,-1,0
if %n% lss 0 set c=0,1,%n:-=%
for /l %%i in (%c%)do call:l %%i 0
exit/b
:l
set s=_
for /l %%j in (1,1,%n:-=%)do call:m %1 %%j
echo %s%
:m
set t=%s%
if %1 lss %2+%2 set t=%s:_= %
set s=%s%%t%%s%

Edit: Saved 12 1819 bytes thanks to @l4m2. Saved 8 bytes by removing the unnecessary %a% variable.

Batch, 265 262 242 236 bytes

@echo off
set/pn=
set c=%n%,-1,0
if %n% lss 0 set c=0,1,%n:-=%
for /l %%i in (%c%)do call:l %%i 0
exit/b
:l
set s=_
for /l %%j in (1,1,%n:-=%)do call:m %1 %%j
echo %s%
:m
set t=%s%
if %1 lss %2 set t=%s:_= %
set s=%s%%t%%s%

Edit: Saved 12 18 bytes thanks to @l4m2. Saved 8 bytes by removing the unnecessary %a% variable.

Batch, 265 262 242 236 235 bytes

@echo off
set/pn=
set c=%n%,-1,0
if %n% lss 0 set c=0,1,%n:-=%
for /l %%i in (%c%)do call:l %%i
exit/b
:l
set s=_
for /l %%j in (1,1,%n:-=%)do call:m %1 %%j
echo %s%
:m
set t=%s%
if %1 lss +%2 set t=%s:_= %
set s=%s%%t%%s%

Edit: Saved 12 19 bytes thanks to @l4m2. Saved 8 bytes by removing the unnecessary %a% variable.

added 11 characters in body
Source Link
Neil
  • 177.3k
  • 12
  • 74
  • 281

Batch, 265 262 242242 236 bytes

@echo off
set/pn=
set c=%n%,-1,0
if %n% lss 0 set c=0,1,%n:-=%
for /l %%i in (%c%)do call:l %%i 0
exit/b
:l
set s=_
for /l %%j in (1,1,%n:-=%)do call:m %1 %%j
echo %s%
exit/b
:m
set t=%s%
if %1 lss %2 set t=%s:_= %
set s=%s%%t%%s%

Edit: Saved 1212 18 bytes thanks to @l4m2. Saved 8 bytes by removing the unnecessary %a% variable.

Batch, 265 262 242 bytes

@echo off
set/pn=
set c=%n%,-1,0
if %n% lss 0 set c=0,1,%n:-=%
for /l %%i in (%c%)do call:l %%i
exit/b
:l
set s=_
for /l %%j in (1,1,%n:-=%)do call:m %1 %%j
echo %s%
exit/b
:m
set t=%s%
if %1 lss %2 set t=%s:_= %
set s=%s%%t%%s%

Edit: Saved 12 bytes thanks to @l4m2. Saved 8 bytes by removing the unnecessary %a% variable.

Batch, 265 262 242 236 bytes

@echo off
set/pn=
set c=%n%,-1,0
if %n% lss 0 set c=0,1,%n:-=%
for /l %%i in (%c%)do call:l %%i 0
exit/b
:l
set s=_
for /l %%j in (1,1,%n:-=%)do call:m %1 %%j
echo %s%
:m
set t=%s%
if %1 lss %2 set t=%s:_= %
set s=%s%%t%%s%

Edit: Saved 12 18 bytes thanks to @l4m2. Saved 8 bytes by removing the unnecessary %a% variable.

added 34 characters in body
Source Link
Neil
  • 177.3k
  • 12
  • 74
  • 281

Batch, 265 262262 242 bytes

@echo off
set/pn=
set a=%n:c=%n%,-=%1,0
if %n% lss 0 for /l %%i inset (0c=0,1,%a%)do call%n:l %%i-=%
for /l %%i in (%n%,-1,0%c%)do call:l %%i
exit/b
:l
set s=_
for /l %%j in (1,1,%a%%n:-=%)do call:m %1 %%j
echo %s%
exit/b
:m
set t=%s%
if %1 lss %2 set t=%s:_= %
set s=%s%%t%%s%

Edit: Saved 12 bytes thanks to @l4m2. Saved 8 bytes by removing the unnecessary %a% variable.

Batch, 265 262 bytes

@echo off
set/pn=
set a=%n:-=%
if %n% lss 0 for /l %%i in (0,1,%a%)do call:l %%i
for /l %%i in (%n%,-1,0)do call:l %%i
exit/b
:l
set s=_
for /l %%j in (1,1,%a%)do call:m %1 %%j
echo %s%
exit/b
:m
set t=%s%
if %1 lss %2 set t=%s:_= %
set s=%s%%t%%s%

Batch, 265 262 242 bytes

@echo off
set/pn=
set c=%n%,-1,0
if %n% lss 0 set c=0,1,%n:-=%
for /l %%i in (%c%)do call:l %%i
exit/b
:l
set s=_
for /l %%j in (1,1,%n:-=%)do call:m %1 %%j
echo %s%
exit/b
:m
set t=%s%
if %1 lss %2 set t=%s:_= %
set s=%s%%t%%s%

Edit: Saved 12 bytes thanks to @l4m2. Saved 8 bytes by removing the unnecessary %a% variable.

removed some unnecessary whitespace
Source Link
Neil
  • 177.3k
  • 12
  • 74
  • 281
Loading
Source Link
Neil
  • 177.3k
  • 12
  • 74
  • 281
Loading