SoFunction
Updated on 2025-04-13

Code to solve mathematical problems with batch processing page 3/4


【06】by [youxi01]
========================================================================================
::The answer is: 29995.

@echo off & echo is detecting data...
setlocal enabledelayedexpansion
for /l %%a in (0 1 9) do (
for /l %%b in (0 1 9) do (
for /l %%c in (0 1 9) do (
set/a Fnum=2%%a%%b%%c5
set Bnum=!Fnum:5=A!
set Bnum=!Bnum:2=5!
set/a Bnum=!Bnum:A=2!
set/a Fnum_=2*!Fnum!+2
if !Bnum! EQU !Fnum_! echo !Fnum!
)))
echo The test is completed!
pause>nul

::Description: This program was tested and passed under XP pro sp2.
::To solve this problem, we must first make it clear that the end of this number must be 5, because only in this way can it be even after conversion and divisible by 2; and the first digit must be ::2...

========================================================================================
【07】by [youxi01]
========================================================================================
::Answer 20th floor: The answer is 10 11 12 13 14

@echo off
echo is detecting data....
setlocal enabledelayedexpansion
for /l %%i in (1 1 10000) do (
set /a flag=0
set /a num=5*%%i+10
set /a num1=!num!%%4
set /a num2=!num!%%5
set /a num3=!num!%%6
for %%a in (!num1! !num2! !num3!) do (
if %%a NEQ 0 set /a flag=1
)
if !flag! EQU 0 set /a num=%%i & goto :exit
)
:exit
for /l %%i in (0 1 4) do (
set /a num%%i=%num%+%%i
)
The 5 consecutive natural numbers required by echo are: %num0% %num1% %num2% %num3% %num4%
pause>nul

xp pro sp2 test passed

========================================================================================
【08】by [youxi01]
========================================================================================

@echo off
rem It is calculated that the first digit must be 1 (unless the unknown number is 1, and 1 is also processed in the first for)
setlocal enabledelayedexpansion
for /l %%i in (0 1 9) do (
set /a Fnum=1%%i3
set /a Bnum=3%%i4
set /a num=!Bnum!/2-9
if !Fnum! EQU !num! echo !Fnum!)

for /l %%i in (0 1 9) do (
set /a Fnum=13%%i
set /a Bnum=34%%i
set /a num=!Bnum!/2-9
if !Fnum! EQU !num! echo !Fnum!)
pause>nul

========================================================================================
【09】by [youxi01]
========================================================================================

@echo off
There are at least 76 chicks:

setlocal enabledelayedexpansion
for /l %%i in (76 1 10000) do (
set /a Fnum=%%i*20-75*20
set /a Bnum=%%i*15+100*15
if !Fnum! EQU !Bnum! echo The number of chicks is: %%i & goto :exit)
:exit
pause>nul

========================================================================================
Previous page1234Next pageRead the full text