Board logo

标题: [原创]*****找最小公倍数***** [打印本页]

作者: s11ss     时间: 2007-9-20 23:33    标题: [原创]*****找最小公倍数*****


@echo off
setlocal enabledelayedexpansion
::::::::::::::::::::::::::::Find The Smallest Public Doubles::::::::::::::::::::::::::::
::::::::::::::::::::::::::::       {s11ss  2007-9-20}       ::::::::::::::::::::::::::::
:r
echo Please input two integers,like 9,20:
set /p n=
echo.
echo Calculating...
set /a i=1
for %%a in (!n!) do (
        set n!i!=%%a
        set /a i+=1
)
if !n1! equ !n2! (
        call :e !n1!
        goto :eof
)
if !n1! lss !n2! (
        set t=!n1!
        set n1=!n2!
        set n2=!t!
)
set /a big=!n1!
set /a t=!n1!
set /a small=!n2!
:c
set /a remain=!big!%%!small!
if !remain! equ 0 (
        call :e !big!
        goto :eof
) else (
        set /a big+=!t!
        goto :c
        )
:e
echo.
echo The smallest public doubles is %1.
echo.
echo Press Any Key To Exit...
pause>nul