1.欧几里得算法又称辗转相除法,是指用于计算两个非负整数a,b的最大公约数。应用领域有数学和计算机两个方面。计算公式gcd(a,b) = gcd(b,a mod b)。
https://baike.baidu.com/item/欧几里得算法/1647675
2.Write"Enter the num1"
Read num1
Write"Enter the num2"
Read num2
Set Rmainder is num1 Mod num2
WHILE(Reminder is not zero)
Set num1 to num2
Set num2 to Reminder
Set Rmainder is num1 Mod num2
//Body of the loop
Write“The gretest common divisor of num1 and num2 is”, num2
3.
1997 / 615 = 3 (余 152)
615 / 152 = 4(余7)
152 / 7 = 21(余5)
7 / 5 = 1 (余2)
5 / 2 = 2 (余1)
2 / 1 = 2 (余0)
至此,最大公约数为1