当然啦,不能把一个数开尽得到小数,但能开到最简- @echo off
- set /p e=请输入要开方的数 :
- set a=%e%
- set b=1
- set g=1
- :a
- set /a b=%b%+1
- set /a k=%b%*%b%
- set /a d=%a%/%k%
- set /a s=%a%%%%k%
- if not "%s%"=="0" (if "%d%"=="0" (goto en) else goto a) else (
- set/a g=%g%*%b% &set a=%d% &set b=1&goto a)
- :en
- if "%s%"=="1" (echo √%e%=%g%) else (
- if "%g%"=="1" (echo √%e%=√%s%) else echo √%e%=%g%√%s%
- )
- pause
复制代码
|