- @echo off
- setlocal enabledelayedexpansion
- for /l %%a in (1,1,9) do (
- for /l %%b in (0,1,9) do (
- set /a bb=%%a*%%a+%%b*%%b
- if !bb!==%%a%%b echo %%a%%b 是水仙花数
- for /l %%c in (0,1,9) do (
- set /a aa=%%a*%%a*%%a+%%b*%%b*%%b+%%c*%%c*%%c
- if !aa!==%%a%%b%%c echo %%a%%b%%c 是水仙花数
- for /l %%d in (0,1,9) do (
- set /a cc=%%a*%%a*%%a+%%b*%%b*%%b+%%c*%%c*%%c+%%d*%%d*%%d
- if !cc!==%%a%%b%%c%%d echo %%a%%b%%c%%d 是水仙花数
- ))))
- echo.&pause
复制代码
|