#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int search(int a,int b){
if(a%b==0) return b;
else search(b,a%b);
}
int main(int argc, char** argv) {
int a,b;
cin>>a>>b;
cout<<search(a,b);
return 0;
}
辗转相除
最新推荐文章于 2019-03-03 22:44:10 发布
本文介绍了一个使用C++编写的最大公约数(GCD)计算程序。该程序通过递归方式实现了两个整数的最大公约数计算,并展示了如何从标准输入读取数值以及输出计算结果。
1039

被折叠的 条评论
为什么被折叠?



