题干

试写出一个算法,并画出流程图,使得能够输入n个正整数值,即可求出它们的最大公约数.

上一题 下一题 0.0难度 选择题 更新时间:2015-05-22 10:15:33

答案(点此获取答案解析)

解:

Readn,a

Fori=2ton

Readb

Ifa<bthenm=a:a=b:b=m

Do

r=mod(a,b)

a=b:b=r

LoopUntilr=0

Ifa=1thenprinda

GotoEnd

Nexti

Printa

End