復(fù)制代碼 代碼如下:
@echo off
:: 九九乘法表
set num=0
for /l %%i in (1,1,9) do (
for /l %%j in (1,1,%%i) do call :multiply %%i %%j
)
pause>nul
goto :eof
:multiply
set /a num+=1
set /a var=%1*%2
set var=%2×%1=%var%
set var=%var%
if %2 equ 1 (set var=%var:~0,5%) else set var=%var:~0,6%
set str=%str% %var%
if %num% equ %1 echo %str%set str=set num=0
goto :eof
:: 另外一種,用Tab鍵替代空格鍵來(lái)排版
@ECHO %DBG% OFF
SETLOCAL ENABLEDELAYEDEXPANSION
for /l %%i in (1,1,9) do (
for /l %%j in (1,1,%%i) do (
set /a h=%%i*%%j
set /p=%%i×%%j^=!h! nul
if %%i==%%j echo.
)
)
pause
@echo off
:: 99 乘法表
setlocal enabledelayedexpansion
for /l %%a in (1,1,9) do (
for /l %%b in (1,1,%%a) do (
set /a i+=1
set /a ans=%%a*%%b
set ans=%%b×%%a=!ans!
set res=!res! !ans:~0,6!
if !i! equ %%a echo!res!set res= set i=0
)
)
pause
您可能感興趣的文章:- javascript和jquery分別實(shí)現(xiàn)的九九乘法表代碼
- for循環(huán)連續(xù)求和、九九乘法表代碼
- jsp/javascript打印九九乘法表代碼
- Java實(shí)現(xiàn)九九乘法表的小例子
- PHP輸出九九乘法表代碼實(shí)例
- sql語(yǔ)句實(shí)現(xiàn)四種九九乘法表
- JS實(shí)現(xiàn)上下左右對(duì)稱的九九乘法表
- awk 九九乘法表 shell實(shí)現(xiàn)代碼
- 基于javascript實(shí)現(xiàn)九九乘法表
- Java語(yǔ)言打印九九乘法表