最大公约数伪代码

1.欧几里德算法又称辗转相除法,是指用于计算两个正整数a,b的最大公约数。以a为被除数,b为除数,计算出余数;以上一次运算的除数和余数分别为被除数与除数;不断重复直到余数为零,且以最后一次运算的除数为最大公约数
https://www.cnblogs.com/ldjhust/p/3188727.html

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

 

 

 

 

posted @ 2020-11-08 16:39  20201214罗云帆  阅读(69)  评论(0编辑  收藏  举报