[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
NEW VERSION
  1. @echo off %老刘制作-数值递增相加%
  2. IF /i "%PROCESSOR_ARCHITECTURE%" EQU "AMD64" (
  3. echo DEBUG和8086_ASM不支持64位的系统。
  4. Pause&Exit
  5. )
  6. %在此感谢netbenton斑竹的十进制转十六进制函数% set "d-h=setlocal enabledelayedexpansion&set/a dx=#a#&set xs=0123456789abcdef&(for /l %%z in (1,1,4) do set /a x%%z=dx%%16,dx=dx/16)&(for /f "tokens=1-4" %%1 in ("!x1! !x2! !x3! !x4!") do set hx=!xs:~%%4,1!!xs:~%%3,1!&(if !hx!==00 set hx=)&(for %%z in ("!hx!!xs:~%%2,1!!xs:~%%1,1!") do endlocal&set #a#=%%~z))"
  7. set /p NUM=Please input a Number:
  8. %d-h:#a#=NUM%
  9. For /f "tokens=2,3" %%a in (
  10. '^(ECHO E20:0 %NUM%^&MORE +13 "%~0"^)^|DEBUG^|FindSTR "0020:0000"'
  11. ) do set /a "num=0x%%a+0X%%b*0X100"
  12. Echo.%num%
  13. pause&exit/b
  14. A
  15. MOV AX,20
  16. MOV DS,AX
  17. MOV CL,BYTE PTR [0]
  18. INC DX
  19. ADD BX,DX
  20. LOOP 109
  21. MOV WORD PTR [0],BX
  22. INT 21H
  23. G
  24. D20:0 1
  25. Q
  26. Q
复制代码
1

评分人数

TOP

回复 9# xiaoxx


    没懂啥意思。。。

TOP

回复 20# dishuo


    这个数学题做的可以,编程写的很精巧。

TOP

  1. @echo off
  2. for /l %%a in (1,1,100) do set /a nm+=1
  3. echo %nm%
  4. pause>nul
  5. exit
复制代码

TOP

  1. @echo off
  2. set /p "n=输入数字:"
  3. for /l %%i in (0,1,%n%) do set /a "sum+=%%i"
  4. echo %sum%
  5. pause
复制代码

TOP

  1. @echo off
  2. set /p "n=输入数字:"
  3. for /l %%i in (0,1,%n%) do set /a "sum+=%%i"
  4. echo %sum%
  5. pause
复制代码

TOP

  1. @set /p "Input=请输入数字:"
  2. @set /a "Output=%Input%*(%Input%+1)/2
  3. @echo %Output%&pause>nul&exit/b
复制代码

TOP

  1. @echo off
  2. setlocal enabledelayedexpansion
  3. set /p n=请输入数值:
  4. set ret=0
  5. for /l %%i in (1,1,!n!) do (
  6. set /a ret=!ret!+%%i
  7. )
  8. echo 计算1+2+3+4+....+n=!ret!
复制代码

TOP

本帖最后由 impk 于 2019-8-31 22:26 编辑
  1. @echo off & setlocal enabledelayedexpansion
  2. for /l %%i in ( 1,1,100 ) do ( set /a n=%%i && set /a sum=!sum!+%%i )
  3. echo !sum!
复制代码

TOP

@echo off
setlocal enabledelayedexpansion
for /l %%i in (1,1,100) do (
        set a=%%i
        set /a summ=summ+!a!
)
echo %summ%
pause>nul

TOP

@echo off
setlocal enabledelayedexpansion
set /p n=请输入需要求和的最大数:
for /l %%i in (1,1,%n%) do (
        set a=%%i
        set /a summ=summ+!a!
)
echo %summ%
pause>nul

TOP

@echo off
:n
set /a a+=1,b+=a
if "%a%"=="100" goto :end
goto :n
:end
echo 求和结束,结果是%b%
pause>nul

@echo off
:n
set /p m=请输入需要参与求和最大值:
set /a a+=1,b+=a
if "%a%"=="%m%" goto :end
goto :n
:end
echo 求和结束,结果是%b%
pause>nul

TOP

@Echo off
for /l %%i in (1,1,100) do set /a n+=%%i
ECHO %n%
pause

TOP

@echo off
for /l %%i in (1,1,100) do set /a a=a+%%i
echo %a%
pause

TOP

@echo off
:sc_start
set /a a+=1
set /a sum+=%a%
if not "%a%"=="100" goto sc_start
echo %sum%
pause

TOP

返回列表