现在的位置: 首页 > 综合 > 正文

【基础】辗转相除

2013年10月05日 ⁄ 综合 ⁄ 共 361字 ⁄ 字号 评论关闭

来自本人百度空间 2009-08-20 16:44

program zhanzhuanxiangchu(input,output);
var
        a,b,c:longint;
begin
        assign(input,'chu.in');
        reset(input);
        assign(output,'chu.out');
        rewrite(output);        readln(a,b);
        close(input);        while a mod b<>0 do begin
            c:=a mod b;
            a:=b;    b:=c;
        end;
        writeln(b);
        close(output);
end.

抱歉!评论已关闭.