求点评~~~
1-6:- @echo off&setlocal enabledelayedexpansion
- set /p "p=请输入要操作的数(1-9):"
- set j=1
- for /l %%a in (1,1,%p%) do (
- set /a p2=%%a*%%a
- set /a p3=%%a*%%a*%%a
- set /a h=!h!+%%a
- set /a j=%%a*!j!
- set /a ph=!ph!+!p2!
- set /a lh=!lh!+!p3!
- )
- echo %p%的平方:%p2%
- echo %p%的立方:%p3%
- echo 从1到%p%的和:%h%
- echo 从1到%p%的积:%j%
- echo 从1到%p%的平方和:%ph%
- echo 从1到%p%的立方和:%lh%
复制代码 数列:- @echo off&setlocal enabledelayedexpansion
- set /p "p=请输入要操作的数(1-9):"
- for /l %%a in (1,1,%p%) do (
- for /l %%i in (1,1,%p%) do (
- set /a n+=1
- set /p=!n! <nul
- )
- echo;
- )
复制代码 螺纹:- @echo off&setlocal enabledelayedexpansion
- set /p p=输入:
- set /a x=1,num=%p%,sum=%p%*%p%
- set yuns=--
- for /l %%y in (1,1,%num%) do (set/a n+=1,y+=1&set _%x%_%%y=!n!)
- :lp
- set /a num-=1
- for /l %%a in (1,1,%num%) do (set/a n+=1,x=!x!%yuns%1&set _!x!_!y!=!n!)
- set yuns=-%yuns%
- for /l %%a in (1,1,%num%) do (set/a n+=1,y=!y!%yuns%1,ys+=1&set _!x!_!y!=!n!)
- if not %n% equ %sum% goto :lp
- for /l %%a in (1,1,%p%) do (
- for /l %%b in (1,1,%p%) do (
- set /p=!_%%a_%%b! <nul
- )
- echo;
- )
复制代码
|