我也借用12楼,rat的代码写写:- @echo off
- set/a num=%random%
- 2>nul set/a1/(%num%%%2)&&echo %num% 是奇数||echo %num% 是偶数
- pause>nul
复制代码
- @echo off
- setlocal enabledelayedexpansion
- set var=%random%
- set num=
- for /f "delims=13579" %%i in ("!var:~-1!") do set num=%%i
- if not defined num (echo !var!是奇数) else (echo !var!是偶数)
- pause>nul
复制代码
[ 本帖最后由 sjzong 于 2009-4-21 23:24 编辑 ] |