zsllq 当前离线
列兵
@echo off set var=0 for /l %%a in (1,1,100) do (set /a var=var+%%a) echo 1+2+3+4+...+100=%var% pause>nul复制代码
TOP
lmhxly 当前离线
smallpigs 当前离线
@echo off :abc cls set /a i = 1 set /p n=請輸入數字: if {%n%}=={} goto abc :acb set /a i+=1,j+=i if %i% neq %n% goto acb echo %j% pause复制代码
lys5300 当前离线
二级士官
@echo off set /a sum=0 for /l %%a in (1 1 100) do ( set/a sum+=%%a ) echo %sum% set sum= pause>nul复制代码
photonjl 当前离线
上等兵
::任意数值的计算 @echo off set str=0 set /p var=input number for /l %%i in (1,1,%var%) do ( set /a str+=%%i ) echo %str% pause>nul复制代码
::从1加到100的 @echo off set str=0 for /l %%i in (1,1,100) do ( set /a str+=%%i ) echo %str% pause>nul复制代码
qinshi52 当前离线
@echo off&setlocal enabledelayedexpansion for /l %%i in (1,1,100) do set /a s+=%%i echo !s! pause复制代码
@echo off&setlocal enabledelayedexpansion set /p n=请输入数字: for /l %%i in (1,1,!n!) do set /a s+=%%i echo !b! pause复制代码
edmond 当前离线
少尉
@echo off set t=0 for /l %%a in (1 1 100) do ( set/a t+=%%a ) echo %t% pause复制代码
lvsehuaxue 当前离线
六级士官
@echo off set n=101 :loop set /a n=n-1 set /a m+=n if %n% neq 0 goto loop echo %m% pause复制代码
gaoyi445267987 当前离线
@echo off SET N=0 SET /P M=INPUT A NUMBER :START SET /A N+=1 SET /A SUM+=%N% IF %N% EQU %M% (ECHO %SUM%) ELSE goto START PAUSE复制代码
piedcity 当前离线
@echo off set /a var=0 for /l %%i in (1,1,100) do ( set /a var+=%%i ) echo %var% pause复制代码
win 当前离线
rem 此为第二个问题答案 @echo off set /p a=请输入数值 for /l %%i in (1,1,%a%) do ( set /a n+=%%i ) echo %n% pause复制代码
rogue_1983 当前离线
@echo off setlocal enabledelayedexpansion for /l %%i in (1 1 100) do set /a b+=%%i echo !b! pause复制代码