RosettaCodeData/Task/Greatest-common-divisor/Batch-File/greatest-common-divisor.bat
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07:00

22 lines
274 B
Batchfile

:: gcd.cmd
@echo off
:gcd
if "%2" equ "" goto :instructions
if "%1" equ "" goto :instructions
if %2 equ 0 (
set final=%1
goto :done
)
set /a res = %1 %% %2
call :gcd %2 %res%
goto :eof
:done
echo gcd=%final%
goto :eof
:instructions
echo Syntax:
echo GCD {a} {b}
echo.