本帖最后由 mxxcgzxxx 于 2011-6-13 19:37 编辑
- @echo off
- :1
- set /p n=请输入数字:
- set /a n*=1
- if %n% lss 1 goto:1
- set /a n=(1+n)*n/2
- echo %n%
- pause>nul
复制代码 没事干再弄一个- @echo off
- :1
- set /p n1=请输入起始数字(大于等于0):
- set /a n1*=1
- if %n1% lss 1 goto:1
- :2
- set /p n2=请输入未尾数字(大于%n1%):
- set /a n2*=1
- if %n2% leq %n1% goto :2
- :3
- set /a n=n2-n1
- set /p n3=请输入数列间跨(小等于%n%):
- set /a n3*=1
- if %n3% lss 1 goto :3
- if %n3% gtr %n% goto :3
- set n=0
- for /l %%1 in (%n1%,%n3%,%n2%) do set /a n=n+%%1
- echo %n%
- pause>nul
复制代码
|