求m,n的最大公因數(shù)(遞歸)
#include<bits/stdc++.h>
using namespace std;
int zc(int x,int y){
if(x%y==0){
return y;
}else{
return zc(y,x%y);
}
}
int main() {
int x,y;
cin>>x>>y;
cout<<zc(x,y);
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int zc(int x,int y){
if(x%y==0){
return y;
}else{
return zc(y,x%y);
}
}
int main() {
int x,y;
cin>>x>>y;
cout<<zc(x,y);
return 0;
}