RosettaCodeData/Task/Greatest-common-divisor/Batch-File/greatest-common-divisor.bat
2023-07-01 13:44:08 -04: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.