复制代码
- @echo off
- set/p a=请输入正整数a
- set/p b=请输入正整数b
- if %a% lss %b% set temp=%a%,a=%b%,b=%temp%
- :start
- set /a r=%a%%%%b%
- if {%r%}=={0} goto end
- set a=%b%
- set b=%r%
- goto start
- :end
- echo a和b的最大公因子是%b%
- pause
欢迎光临 批处理之家 (http://www.bathome.net/) | Powered by Discuz! 7.2 |